<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>两小路演系统原型图</title>
    <!-- WeUI -->
    <link rel="stylesheet" href="https://weui.io/style/weui.min.css" />
    <!-- Element UI -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
    <style>
      body {
        background-color: #f0f2f5;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
          'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
          'Noto Color Emoji';
        margin: 0;
        padding: 0;
        color: #333;
        display: flex;
      }
      
      /* 左侧导航菜单样式 - 深色主题 */
      .sidebar {
        width: 280px;
        height: 100vh;
        background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1000;
        overflow-y: auto;
        padding: 20px 0;
      }
      
      .sidebar-header {
        padding: 0 20px 20px;
        border-bottom: 1px solid #404040;
        margin-bottom: 20px;
      }
      
      .sidebar-title {
        font-size: 18px;
        font-weight: 600;
        color: #ffffff;
        margin: 0;
      }
      
      .sidebar-subtitle {
        font-size: 12px;
        color: #b0b0b0;
        margin: 5px 0 0 0;
      }
      
      .nav-section {
        margin-bottom: 20px;
      }
      
      .nav-section-title {
        font-size: 14px;
        font-weight: 600;
        color: #ffffff;
        padding: 0 20px 10px;
        margin: 0;
        margin-right: 20px;
        padding-left: 15px;
        border-radius: 0 4px 4px 0;
      }
      
      .nav-item {
        display: block;
        padding: 10px 20px 10px 40px;
        color: #b0b0b0;
        text-decoration: none;
        font-size: 13px;
        transition: all 0.3s ease;
        border-left: 2px solid transparent;
        position: relative;
        margin: 2px 0;
      }
      
      .nav-item:hover {
        background: linear-gradient(90deg, rgba(24, 144, 255, 0.1) 0%, rgba(64, 169, 255, 0.05) 100%);
        color: #ffffff;
        border-left-color: #1890ff;
        transform: translateX(4px);
      }
      
      .nav-item.active {
        background: linear-gradient(90deg, rgba(24, 144, 255, 0.2) 0%, rgba(64, 169, 255, 0.1) 100%);
        color: #ffffff;
        border-left-color: #1890ff;
        font-weight: 500;
        box-shadow: inset 0 0 10px rgba(24, 144, 255, 0.1);
      }
      
      .nav-item::before {
        content: '📱';
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        filter: grayscale(0.3);
      }
      
      .nav-item:hover::before,
      .nav-item.active::before {
        filter: grayscale(0);
      }
      
      /* 主内容区域 */
      .main-content {
        flex: 1;
        margin-left: 280px;
        padding: 24px;
        min-height: 100vh;
      }
      
      /* 页面高亮样式 */
      .page-highlight {
        animation: highlight 2s ease-in-out;
        box-shadow: 0 0 0 4px #1890ff, 0 0 0 8px rgba(24, 144, 255, 0.3);
        border-radius: 20px;
      }
      
      @keyframes highlight {
        0% {
          box-shadow: 0 0 0 0 #1890ff;
        }
        50% {
          box-shadow: 0 0 0 8px #1890ff, 0 0 0 16px rgba(24, 144, 255, 0.3);
        }
        100% {
          box-shadow: 0 0 0 4px #1890ff, 0 0 0 8px rgba(24, 144, 255, 0.3);
        }
      }
      
      /* 返回顶部按钮 */
      .back-to-top {
        position: fixed;
        right: 30px;
        bottom: 30px;
        width: 50px;
        height: 50px;
        background: #1890ff;
        color: white;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        font-size: 20px;
        box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
        transition: all 0.3s;
        z-index: 999;
        display: none;
      }
      
      .back-to-top:hover {
        background: #40a9ff;
        transform: translateY(-2px);
      }
      
      .back-to-top.show {
        display: block;
      }
      h1,
      h2 {
        color: #1a1a1a;
        text-align: center;
        margin-bottom: 24px;
      }
      h2 {
        font-size: 1.2em;
        margin-top: 32px;
      }
      .mobile-view {
        width: 375px;
        min-width: 375px;
        max-width: 375px;
        height: 812px;
        overflow-y: auto;
        border-radius: 20px;
        margin: 0 16px 32px 0;
        box-shadow: 0 2px 12px #0001;
        display: inline-block;
        vertical-align: top;
        position: relative;
      }
      .mobile-view .weui-navbar {
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(255, 255, 255, 0.62);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 8px #0001;
      }
      .pc-view {
        width: 1200px;
        height: 1800px;
        margin: 0 auto 32px auto;
        background: #fff;
        box-shadow: 0 2px 12px #0001;
      }
      .page-row {
        display: flex;
        flex-direction: row;
        gap: 24px;
        margin-bottom: 32px;
        flex-wrap: wrap;
        min-width: 100%;
      }

      /* 步骤条样式 - 完全符合WeUI官方源码 */
      .weui-steps {
        position: relative;
        padding-left: 20px;
      }
      .weui-step {
        position: relative;
        padding-bottom: 20px;
      }
      .weui-step:last-child {
        padding-bottom: 0;
      }
      .weui-step::before {
        content: '';
        position: absolute;
        left: 10px;
        top: 0;
        bottom: 0;
        width: 1px;
        background-color: #e5e5e5;
      }
      .weui-step:last-child::before {
        display: none;
      }
      .weui-step__icon {
        position: absolute;
        left: 0;
        top: 0;
        width: 20px;
        height: 20px;
        line-height: 20px;
        text-align: center;
        border-radius: 50%;
        background-color: #07c160;
        color: #fff;
        font-size: 12px;
      }
      .weui-step__content {
        margin-left: 30px;
      }
      .weui-step__title {
        font-size: 16px;
        font-weight: bold;
        color: #000;
        margin-bottom: 8px;
        line-height: 24px;
      }
      .weui-step__desc {
        font-size: 14px;
        color: #999;
        line-height: 20px;
      }
    </style>
  </head>
  <body data-weui-theme="light">
    <!-- 左侧导航菜单 -->
    <div class="sidebar">
      <div class="sidebar-header">
        <h1 class="sidebar-title">两小路演系统</h1>
        <p class="sidebar-subtitle">原型图导航</p>
      </div>
      
      <!-- 首页和活动管理 -->
      <div class="nav-section">
        <h3 class="nav-section-title">首页和活动管理</h3>
        <a href="#page-home" class="nav-item" data-page="page-home">首页</a>
        <a href="#page-activity-detail" class="nav-item" data-page="page-activity-detail">活动详情</a>
        <a href="#page-activity-register" class="nav-item" data-page="page-activity-register">活动信息登记</a>
      </div>
      
      <!-- 客户管理 -->
      <div class="nav-section">
        <h3 class="nav-section-title">客户管理</h3>
        <a href="#page-customer-detail" class="nav-item" data-page="page-customer-detail">客户信息详情</a>
        <a href="#page-customer-edit" class="nav-item" data-page="page-customer-edit">编辑客户信息</a>
        <a href="#page-reserve-customer-edit" class="nav-item" data-page="page-reserve-customer-edit">储备客户信息编辑</a>
      </div>
      
      <!-- 渠道管理 -->
      <div class="nav-section">
        <h3 class="nav-section-title">渠道管理</h3>
        <a href="#page-channel-detail" class="nav-item" data-page="page-channel-detail">渠道信息详情</a>
        <a href="#page-channel-edit" class="nav-item" data-page="page-channel-edit">编辑渠道信息</a>
      </div>
      
      <!-- 辅助选择页面 -->
      <div class="nav-section">
        <h3 class="nav-section-title">辅助选择页面</h3>
        <a href="#page-activity-list" class="nav-item" data-page="page-activity-list">活动列表</a>
        <a href="#page-customer-list" class="nav-item" data-page="page-customer-list">客户列表</a>
        <a href="#page-channel-list" class="nav-item" data-page="page-channel-list">渠道列表</a>
      </div>
      
      <!-- 走访管理 -->
      <div class="nav-section">
        <h3 class="nav-section-title">走访管理</h3>
        <a href="#page-customer-visit-register" class="nav-item" data-page="page-customer-visit-register">客户走访登记</a>
        <a href="#page-customer-visit-detail" class="nav-item" data-page="page-customer-visit-detail">客户走访详情</a>
        <a href="#page-channel-visit-register" class="nav-item" data-page="page-channel-visit-register">渠道走访登记</a>
        <a href="#page-channel-visit-detail" class="nav-item" data-page="page-channel-visit-detail">渠道走访详情</a>
      </div>
    </div>
    
    <!-- 主内容区域 -->
    <div class="main-content">
      <h1>两小路演系统原型图</h1>
    <!-- 客户经理端页面 -->
    <h2>客户经理端 - 移动端</h2>
    <div class="page-row">
      <!-- 首页/工作台页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-home">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">首页</div>
        </div>
        <div class="weui-search-bar" id="searchBar">
          <form class="weui-search-bar__form">
            <div class="weui-search-bar__box">
              <i class="weui-icon-search"></i>
              <input
                type="search"
                class="weui-search-bar__input"
                placeholder="搜索活动、客户、渠道..."
                id="search-input"
              />
              <a
                href="javascript:"
                class="weui-icon-clear"
                id="search-clear"
                style="display: none"
              ></a>
            </div>
            <label class="weui-search-bar__label" id="search-label">
              <i class="weui-icon-search"></i>
              <span>搜索活动、客户、渠道...</span>
            </label>
          </form>
        </div>

        <div class="weui-tab">
          <div class="weui-navbar">
            <div class="weui-navbar__item weui-navbar__item_on" data-tab="activity">活动</div>
            <div class="weui-navbar__item" data-tab="channel">渠道</div>
            <div class="weui-navbar__item" data-tab="customer">客户</div>
            <div class="weui-navbar__item" data-tab="visit">走访</div>
            <div class="weui-navbar__item" data-tab="reserve">储备</div>
          </div>
          <div class="weui-tab__panel">
            <div id="tab-content"></div>
          </div>
        </div>

        <!-- 网格员新增弹窗 -->
        <div class="weui-mask" id="grid-member-mask" style="display: none"></div>
        <div class="weui-dialog" id="grid-member-dialog" style="display: none">
          <div class="weui-dialog__hd">
            <strong class="weui-dialog__title">新增网格员</strong>
          </div>
          <div class="weui-dialog__bd">
            <div class="weui-cell">
              <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
              <div class="weui-cell__bd">
                <input class="weui-input" id="grid-member-name" placeholder="请输入姓名" />
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd"><label class="weui-label">手机号码</label></div>
              <div class="weui-cell__bd">
                <input class="weui-input" id="grid-member-phone" placeholder="请输入手机号码" />
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd"><label class="weui-label">职务</label></div>
              <div class="weui-cell__bd">
                <input class="weui-input" id="grid-member-position" placeholder="请输入职务" />
              </div>
            </div>
          </div>
          <div class="weui-dialog__ft">
            <a
              href="javascript:;"
              class="weui-dialog__btn weui-dialog__btn_default"
              onclick="closeGridMemberDialog()"
            >
              取消
            </a>
            <a
              href="javascript:;"
              class="weui-dialog__btn weui-dialog__btn_primary"
              onclick="saveGridMember()"
            >
              确定
            </a>
          </div>
        </div>

        <!-- 客户关联弹窗 -->
        <div class="weui-mask" id="customer-association-mask" style="display: none"></div>
        <div class="weui-dialog" id="customer-association-dialog" style="display: none">
          <div class="weui-dialog__hd">
            <strong class="weui-dialog__title">关联客户</strong>
          </div>
          <div class="weui-dialog__bd">
            <div class="weui-search-bar" id="searchBar-customer-association">
              <form class="weui-search-bar__form">
                <div class="weui-search-bar__box">
                  <i class="weui-icon-search"></i>
                  <input
                    type="search"
                    class="weui-search-bar__input"
                    placeholder="搜索客户"
                    id="customer-search-input"
                  />
                  <a href="javascript:" class="weui-icon-clear" id="customer-search-clear"></a>
                </div>
                <label class="weui-search-bar__label" id="customer-search-text">
                  <i class="weui-icon-search"></i>
                  <span>搜索客户</span>
                </label>
              </form>
            </div>
            <div
              class="weui-cells"
              id="customer-association-list"
              style="max-height: 300px; overflow-y: auto"
            ></div>
          </div>
          <div class="weui-dialog__ft">
            <a
              href="javascript:;"
              class="weui-dialog__btn weui-dialog__btn_default"
              onclick="closeCustomerAssociationDialog()"
            >
              取消
            </a>
          </div>
        </div>

        <script>
          // tab切换事件
          document.addEventListener('DOMContentLoaded', function () {
            function renderTabContent(tab) {
              const container = document.getElementById('tab-content')
              container.innerHTML = ''
              if (tab === 'activity') {
                renderActivityList('', container, true)
              } else if (tab === 'customer') {
                // 客户列表已重构为静态HTML，显示静态内容
                container.innerHTML = `
                  <div class="weui-panel">
                    <div class="weui-panel__hd" style="display: flex; justify-content: space-between; align-items: center;">
                      <span style="flex: 1;">客户列表</span>
                      <button class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleAddCustomer()">新增客户</button>
                    </div>
                    <div class="weui-panel__bd">
                      <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                          <p style="font-weight:500;">王**</p>
                          <p style="color:#888;font-size:14px;">电话：186****0897</p>
                          <p style="color:#888;font-size:14px;">渠道：南京制造业协会</p>
                        </div>
                        <div class="weui-cell__ft">
                          <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleVisit('王**', '南京制造业协会')">走访</a>
                        </div>
                      </div>
                      <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                          <p style="font-weight:500;">李**</p>
                          <p style="color:#888;font-size:14px;">电话：138****1234</p>
                          <p style="color:#888;font-size:14px;">渠道：秦淮区政府</p>
                        </div>
                        <div class="weui-cell__ft">
                          <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleVisit('李**', '秦淮区政府')">走访</a>
                        </div>
                      </div>
                      <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                          <p style="font-weight:500;">张**</p>
                          <p style="color:#888;font-size:14px;">电话：159****5678</p>
                          <p style="color:#888;font-size:14px;">渠道：建邺区政府</p>
                        </div>
                        <div class="weui-cell__ft">
                          <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleVisit('张**', '建邺区政府')">走访</a>
                        </div>
                      </div>
                      <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                          <p style="font-weight:500;">陈**</p>
                          <p style="color:#888;font-size:14px;">电话：177****9012</p>
                          <p style="color:#888;font-size:14px;">渠道：玄武区商会</p>
                        </div>
                        <div class="weui-cell__ft">
                          <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleVisit('陈**', '玄武区商会')">走访</a>
                        </div>
                      </div>
                      <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                          <p style="font-weight:500;">刘**</p>
                          <p style="color:#888;font-size:14px;">电话：188****3456</p>
                          <p style="color:#888;font-size:14px;">渠道：栖霞区商会</p>
                        </div>
                        <div class="weui-cell__ft">
                          <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleVisit('刘**', '栖霞区商会')">走访</a>
                        </div>
                      </div>
                    </div>
                  </div>
                `
              } else if (tab === 'channel') {
                renderChannelList('', container, true)
              } else if (tab === 'visit') {
                renderVisitList(container, true)
              } else if (tab === 'reserve') {
                renderReserveCustomerList('', container, true)
              }
            }

            // 修改renderXXXList函数，支持传入容器和是否显示新增按钮
            window.renderActivityList = function (
              filter = '',
              container = document.getElementById('activity-list-full'),
              showAdd = false
            ) {
              let filtered = activities
              if (filter) {
                filtered = activities.filter(
                  (act) =>
                    act.活动名称.includes(filter) ||
                    act.二级分行.includes(filter) ||
                    (act.主要条线 && act.主要条线.join(',').includes(filter))
                )
              }
              let html = `<div class="weui-panel weui-panel_access">
              <div class="weui-panel__hd" style="display:flex;justify-content:space-between;align-items:center;">
                <span style="flex:1">共 ${filtered.length} 条</span>`
              if (showAdd) {
                html += `<button class="weui-btn weui-btn_mini weui-btn_primary" style="float: right" onclick="handleAddActivity()">新增活动</button>`
              }
              html += `</div><div class="weui-panel__bd">`
              if (filtered.length === 0) {
                html +=
                  '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>'
              } else {
                filtered.forEach((act) => {
                  html += `<div class="weui-media-box weui-media-box_appmsg">
                  <div class="weui-media-box__bd">
                    <div class="weui-media-box__title">${act.活动名称}</div>
                    <div class="weui-media-box__desc">
                      日期：${act.活动召开日期}<br />
                      地点：${act.活动地点县区} ${act.活动地点镇街道}<br />
                      条线：${act.主要条线.join('、')}
                    </div>
                  </div>
                  <div class="weui-media-box__ft">
                    <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_default">详情</a>
                  </div>
                </div>`
                })
              }
              html += '</div></div>'
              container.innerHTML = html
            }

            // window.renderCustomerList 已移除，客户列表使用静态HTML

            window.renderChannelList = function (
              filter = '',
              container = document.getElementById('channel-list-full'),
              showAdd = false
            ) {
              let filtered = channels
              if (filter) {
                filtered = channels.filter(
                  (cha) =>
                    cha.具体B端名称.includes(filter) ||
                    cha.渠道类型.includes(filter) ||
                    cha.具体B端类型.includes(filter)
                )
              }
              let html = `<div class="weui-panel weui-panel_access">
              <div class="weui-panel__hd" style="display:flex;justify-content:space-between;align-items:center;">
                <span style="flex:1">共 ${filtered.length} 条</span>`
              if (showAdd) {
                html += `<button class="weui-btn weui-btn_mini weui-btn_primary" style="float: right">新增渠道</button>`
              }
              html += `</div><div class="weui-panel__bd">`
              if (filtered.length === 0) {
                html +=
                  '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>'
              } else {
                filtered.forEach((cha) => {
                  html += `<div class="weui-media-box weui-media-box_appmsg">
                  <div class="weui-media-box__bd">
                    <div class="weui-media-box__title">${cha.具体B端名称}</div>
                    <div class="weui-media-box__desc">
                      类型：${cha.渠道类型}<br />
                      覆盖人数：${cha.覆盖人数 || ''}<br />
                      状态：${cha.状态 || ''}
                    </div>
                  </div>
                  <div class="weui-media-box__ft">
                    <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_default">详情</a>
                  </div>
                </div>`
                })
              }
              html += '</div></div>'
              container.innerHTML = html
            }

            window.renderVisitList = function (container, showAdd = false) {
              let visitsList = window.visits || visits || []
              let html = `<div class="weui-panel weui-panel_access">
              <div class="weui-panel__hd" style="display:flex;justify-content:space-between;align-items:center;">
                <span style="flex:1">共 ${visitsList.length} 条</span>`
              if (showAdd) {
                html += `<button class="weui-btn weui-btn_mini weui-btn_primary" style="float: right">新增走访</button>`
              }
              html += `</div><div class="weui-panel__bd">`
              if (visitsList.length === 0) {
                html +=
                  '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>'
              } else {
                visitsList.forEach((v) => {
                  html += `<div class="weui-media-box weui-media-box_appmsg">
                    <div class="weui-media-box__bd">
                      <div class="weui-media-box__title">${v.客户姓名 || v.渠道名称 || ''}</div>
                      <div class="weui-media-box__desc">
                        走访日期：${v.走访日期 || ''}<br />
                        走访类型：${visitsList.indexOf(v) % 2 === 0 ? '客户走访' : '渠道走访'}<br />
                      </div>
                    </div>
                    <div class="weui-media-box__ft">
                      <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_default">详情</a>
                    </div>
                  </div>`
                })
              }
              html += '</div></div>'
              container.innerHTML = html
            }

            // 储备客户列表渲染函数
            window.renderReserveCustomerList = function (
              filter = '',
              container = document.getElementById('reserve-customer-list-full'),
              showAdd = false
            ) {
              let filtered = reserveCustomers
              if (filter) {
                filtered = reserveCustomers.filter(
                  (cus) =>
                    cus.姓名.includes(filter) ||
                    cus.联系方式.includes(filter) ||
                    (cus.所属渠道 || '').includes(filter)
                )
              }
              let html = `<div class="weui-panel weui-panel_access">
              <div class="weui-panel__hd" style="display:flex;justify-content:space-between;align-items:center;">
                <span style="flex:1">共 ${filtered.length} 条</span>`
              html += `</div><div class="weui-panel__bd">`
              if (filtered.length === 0) {
                html +=
                  '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>'
              } else {
                filtered.forEach((cus) => {
                  // 根据储备状态设置按钮颜色（镂空样式）
                  let statusBtnColor = '#FA5151' // 默认红色
                  if (cus.储备状态 === '已放款') statusBtnColor = '#1AAD19'
                  else if (cus.储备状态 === '已支用') statusBtnColor = '#10AEFF'

                  html += `<div class="weui-media-box weui-media-box_appmsg">
                  <div class="weui-media-box__bd">
                    <div class="weui-media-box__title">${cus.姓名[0]}**</div>
                    <div class="weui-media-box__desc">
                      电话：${cus.联系方式}<br />
                      产品：${cus.产品 || '暂无'}
                    </div>
                  </div>
                  <div class="weui-media-box__ft" style="display: flex; flex-direction: column; align-items: flex-end; gap: 8px;">
                    <a href="javascript:;" class="weui-btn weui-btn_mini" style="margin: 0; color: #666; background: transparent; border: none; text-decoration: underline;">详情</a>
                    <button class="weui-btn weui-btn_mini status-btn" data-customer-id="${
                      cus.id
                    }" style="margin: 0; color: ${statusBtnColor}; background: transparent; border: 1px solid ${statusBtnColor};">${
                    cus.储备状态 || '审批中'
                  }</button>
                    </div>
                  </div>`
                })
              }
              html += '</div></div>'
              container.innerHTML = html
            }

            // tab切换事件
            document.querySelectorAll('.weui-navbar__item').forEach((item) => {
              item.addEventListener('click', function () {
                document
                  .querySelectorAll('.weui-navbar__item')
                  .forEach((i) => i.classList.remove('weui-navbar__item_on'))
                this.classList.add('weui-navbar__item_on')
                const tab = this.getAttribute('data-tab')
                renderTabContent(tab)
              })
            })

            // 默认渲染活动tab
            renderTabContent('activity')

            // 新增客户按钮处理函数
            window.handleAddCustomer = function () {
              weui.confirm('请前往首页，新增客户', {
                title: '提示',
                buttons: [
                  {
                    label: '我知道了',
                    type: 'default',
                  },
                ],
              })
            }

            // 新增走访按钮处理函数
            window.handleAddVisit = function () {
              weui.confirm('跳转到客户走访登记页面', {
                title: '提示',
                buttons: [
                  {
                    label: '我知道了',
                    type: 'default',
                  },
                ],
              })
            }

            // 新增渠道走访按钮处理函数
            window.handleAddChannelVisit = function () {
              weui.confirm('跳转到渠道走访登记页面', {
                title: '提示',
                buttons: [
                  {
                    label: '我知道了',
                    type: 'default',
                  },
                ],
              })
            }

            // 定位按钮处理函数
            window.handleLocationSelect = function () {
              weui.confirm('打开地图选择地址', {
                title: '定位',
                buttons: [
                  {
                    label: '取消',
                    type: 'default',
                  },
                  {
                    label: '确定',
                    type: 'primary',
                  },
                ],
              })
            }

            // 新增渠道按钮处理函数
            window.handleAddChannel = function () {
              weui.confirm('请前往首页，新增渠道', {
                title: '提示',
                buttons: [
                  {
                    label: '我知道了',
                    type: 'default',
                  },
                ],
              })
            }

            // 新增走访按钮处理函数
            window.handleAddVisit = function () {
              weui.confirm('请前往首页，新增走访', {
                title: '提示',
                buttons: [
                  {
                    label: '我知道了',
                    type: 'default',
                  },
                  {
                    label: '确定',
                    type: 'primary',
                  },
                ],
              })
            }

            // 新增活动按钮处理函数
            window.handleAddActivity = function () {
              weui.confirm('请前往首页，新增活动', {
                title: '提示',
                buttons: [
                  {
                    label: '我知道了',
                    type: 'default',
                  },
                  {
                    label: '确定',
                    type: 'primary',
                  },
                ],
              })
            }

            // 网格员选择/录入交互
            window.handleGridMemberSelect = function () {
              const select = document.getElementById('grid-member-select')
              const manualInput = document.getElementById('manual-grid-member-input')
              const phoneInput = document.getElementById('grid-member-phone')
              const phoneCell = document.getElementById('grid-member-phone-cell')
              const manualNameInput = document.getElementById('manual-grid-member-name')
              const manualPhoneInput = document.getElementById('manual-grid-member-phone')

              if (select.value === 'manual') {
                // 显示手动录入输入框（包含姓名和手机号），隐藏单独的手机号字段
                manualInput.style.display = 'block'
                phoneCell.style.display = 'none'
                // 清空单独的手机号字段
                phoneInput.value = ''
                // 清空手动录入字段
                manualNameInput.value = ''
                manualPhoneInput.value = ''
              } else if (select.value && select.value !== 'manual') {
                // 选择了现有网格员，隐藏手动录入，显示单独的手机号字段并自动填充
                manualInput.style.display = 'none'
                phoneCell.style.display = 'block'
                const selectedOption = select.options[select.selectedIndex]
                const phone = selectedOption.getAttribute('data-phone')
                if (phone) {
                  phoneInput.value = phone
                }
                // 清空手动录入字段
                manualNameInput.value = ''
                manualPhoneInput.value = ''
              } else {
                // 清空选择，隐藏所有相关字段
                manualInput.style.display = 'none'
                phoneCell.style.display = 'none'
                phoneInput.value = ''
                manualNameInput.value = ''
                manualPhoneInput.value = ''
              }
            }

            // 走访页面网格员选择/录入交互
            window.handleVisitGridMemberSelect = function () {
              const select = document.getElementById('visit-grid-member-select')
              const manualInput = document.getElementById('visit-manual-grid-member-input')
              const phoneInput = document.getElementById('visit-grid-member-phone')
              const phoneCell = document.getElementById('visit-grid-member-phone-cell')
              const manualNameInput = document.getElementById('visit-manual-grid-member-name')
              const manualPhoneInput = document.getElementById('visit-manual-grid-member-phone')

              if (select.value === 'manual') {
                // 显示手动录入输入框（包含姓名和手机号），隐藏单独的手机号字段
                manualInput.style.display = 'block'
                phoneCell.style.display = 'none'
                // 清空单独的手机号字段
                phoneInput.value = ''
                // 清空手动录入字段
                manualNameInput.value = ''
                manualPhoneInput.value = ''
              } else if (select.value && select.value !== 'manual') {
                // 选择了现有网格员，隐藏手动录入，显示单独的手机号字段并自动填充
                manualInput.style.display = 'none'
                phoneCell.style.display = 'block'
                const selectedOption = select.options[select.selectedIndex]
                const phone = selectedOption.getAttribute('data-phone')
                if (phone) {
                  phoneInput.value = phone
                }
                // 清空手动录入字段
                manualNameInput.value = ''
                manualPhoneInput.value = ''
              } else {
                // 清空选择，隐藏所有相关字段
                manualInput.style.display = 'none'
                phoneCell.style.display = 'none'
                phoneInput.value = ''
                manualNameInput.value = ''
                manualPhoneInput.value = ''
              }
            }

            // 储备状态变更 Action Sheet 交互
            let currentCustomerId = null
            const statusActionsheet = document.getElementById('status-actionsheet')
            const statusMask = document.getElementById('status-mask')
            const actionsheetCancel = document.getElementById('actionsheet-cancel')

            // 显示 action sheet
            function showStatusActionsheet(customerId) {
              if (!statusActionsheet || !statusMask) return
              currentCustomerId = customerId
              statusActionsheet.style.display = 'block'
              statusMask.style.display = 'block'
              setTimeout(() => {
                statusActionsheet.style.transform = 'translateY(0)'
                statusMask.style.opacity = '1'
              }, 50)
            }

            // 隐藏 action sheet
            function hideStatusActionsheet() {
              if (statusActionsheet && statusMask) {
                statusActionsheet.style.transform = 'translateY(100%)'
                statusMask.style.opacity = '0'
                setTimeout(() => {
                  statusActionsheet.style.display = 'none'
                  statusMask.style.display = 'none'
                }, 200)
              }
              currentCustomerId = null
            }

            // 储备状态按钮点击事件委托
            document.addEventListener('click', function (e) {
              if (e.target.classList.contains('status-btn')) {
                e.preventDefault()
                e.stopPropagation()
                const customerId = e.target.getAttribute('data-customer-id')
                showStatusActionsheet(customerId)
              }
            })

            // Action sheet 选项点击
            document
              .querySelectorAll('#status-actionsheet .weui-actionsheet__cell[data-status]')
              .forEach((cell) => {
                cell.addEventListener('click', function () {
                  const newStatus = this.getAttribute('data-status')
                  if (currentCustomerId && newStatus) {
                    // 更新数据
                    const customer = customers.find((c) => c.id === currentCustomerId)
                    if (customer) {
                      customer.储备状态 = newStatus
                      // 重新渲染客户标签页
                      if (
                        document
                          .querySelector('.weui-navbar__item[data-tab="customer"]')
                          .classList.contains('weui-navbar__item_on')
                      ) {
                        renderTabContent('customer')
                      }
                    }
                  }
                  hideStatusActionsheet()
                })
              })

            // 取消按钮和遮罩点击
            if (actionsheetCancel)
              actionsheetCancel.addEventListener('click', hideStatusActionsheet)
            if (statusMask) statusMask.addEventListener('click', hideStatusActionsheet)
          })
        </script>

        <!-- 储备状态变更 Action Sheet -->
        <div
          id="status-actionsheet"
          class="weui-actionsheet"
          style="
            display: none;
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 5000;
            background: white;
            border-radius: 10px 10px 0 0;
            transform: translateY(100%);
            transition: transform 0.3s ease-out;
          "
        >
          <div class="weui-actionsheet__menu">
            <div
              class="weui-actionsheet__cell"
              data-status="审批中"
              style="
                padding: 16px;
                text-align: center;
                border-bottom: 1px solid #f0f0f0;
                cursor: pointer;
              "
            >
              审批中
            </div>
            <div
              class="weui-actionsheet__cell"
              data-status="已放款"
              style="
                padding: 16px;
                text-align: center;
                border-bottom: 1px solid #f0f0f0;
                cursor: pointer;
              "
            >
              已放款
            </div>
            <div
              class="weui-actionsheet__cell"
              data-status="已支用"
              style="
                padding: 16px;
                text-align: center;
                border-bottom: 1px solid #f0f0f0;
                cursor: pointer;
              "
            >
              已支用
            </div>
          </div>
          <div class="weui-actionsheet__action" style="border-top: 8px solid #f0f0f0">
            <div
              class="weui-actionsheet__cell"
              id="actionsheet-cancel"
              style="padding: 16px; text-align: center; cursor: pointer; color: #999"
            >
              取消
            </div>
          </div>
        </div>
        <div
          id="status-mask"
          class="weui-mask"
          style="
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 4999;
            opacity: 0;
            transition: opacity 0.3s ease-out;
          "
        ></div>
      </div>
      <!-- 活动详情页面（数据渲染） -->
      <div class="mobile-view" id="page-activity-detail">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">活动详情</div>
        </div>
        <div class="weui-form-preview" id="activity-detail-preview2"></div>
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">共 1 条渠道</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-activity-channel">
              关联渠道
            </button>
          </div>
          <div class="weui-panel__bd" id="activity-detail-channel-list"></div>
        </div>
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">共 2 条客户</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-activity-customer">
              关联客户
            </button>
          </div>
          <div class="weui-panel__bd" id="activity-detail-customer-list-1"></div>
        </div>
      </div>
      <!-- 活动基本信息登记页面（编辑/回显） -->
      <div class="mobile-view" id="page-activity-register">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">活动信息登记</div>
        </div>
        <form class="weui-form" id="activity-edit-form">
          <div class="weui-form__control-area">
            <!-- 活动基本信息区域 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">活动基本信息</div>
              <div class="weui-cells weui-cells_form" id="activity-edit-fields">
                <!-- 归属场景 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      归属场景
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-scene" value="" readonly required />
                  </div>
                </div>

                <!-- 二级分行 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      二级分行
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-branch" value="" readonly required />
                  </div>
                </div>

                <!-- 一级支行 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      一级支行
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-sub-branch" value="" readonly required />
                  </div>
                </div>

                <!-- 主要条线 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      主要条线
                    </label>
                  </div>
                  <div
                    class="weui-cell__bd"
                    style="display: flex; flex-direction: column; gap: 8px; align-items: flex-start"
                  >
                    <label style="display: flex; align-items: center; font-size: 15px">
                      <input
                        type="checkbox"
                        name="mainLine"
                        value="三农"
                        style="margin-right: 4px"
                      />
                      三农
                    </label>
                    <label style="display: flex; align-items: center; font-size: 15px">
                      <input
                        type="checkbox"
                        name="mainLine"
                        value="普惠"
                        style="margin-right: 4px"
                      />
                      普惠
                    </label>
                    <label style="display: flex; align-items: center; font-size: 15px">
                      <input
                        type="checkbox"
                        name="mainLine"
                        value="小企业"
                        style="margin-right: 4px"
                      />
                      小企业
                    </label>
                    <label style="display: flex; align-items: center; font-size: 15px">
                      <input
                        type="checkbox"
                        name="mainLine"
                        value="小贷"
                        style="margin-right: 4px"
                      />
                      小贷
                    </label>
                  </div>
                </div>

                <!-- 活动名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动名称
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-name" value="" required />
                  </div>
                </div>

                <!-- 活动召开日期 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动召开日期
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="date" id="activity-date" value="" required />
                  </div>
                </div>

                <!-- 活动地点（县/区） -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动地点（县/区）
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="activity-district" required>
                      <option value="">请选择县/区</option>
                      <option value="鼓楼区">鼓楼区</option>
                      <option value="秦淮区">秦淮区</option>
                      <option value="建邺区">建邺区</option>
                      <option value="玄武区">玄武区</option>
                      <option value="栖霞区">栖霞区</option>
                    </select>
                  </div>
                </div>

                <!-- 活动地点（镇/街道） -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动地点（镇/街道）</label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="activity-street">
                      <option value="">请选择镇/街道</option>
                      <option value="中央门街道">中央门街道</option>
                      <option value="瑞金路街道">瑞金路街道</option>
                      <option value="江东街道">江东街道</option>
                      <option value="新街口街道">新街口街道</option>
                      <option value="迈皋桥街道">迈皋桥街道</option>
                    </select>
                  </div>
                </div>

                <!-- 共同发起方 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      共同发起方
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-sponsor" value="" required />
                  </div>
                </div>

                <!-- 共同发起方出席人员及职务 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      共同发起方出席人员及职务
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-sponsor-staff" value="" required />
                  </div>
                </div>

                <!-- 活动针对的主要区域、客群 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动针对的主要区域、客群
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-target-group" value="" required />
                  </div>
                </div>

                <!-- 活动针对的主要行业 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动针对的主要行业
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-industry" value="" required />
                  </div>
                </div>

                <!-- 代表性企业名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">代表性企业名称</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="activity-representative-company" value="" />
                  </div>
                </div>

                <!-- 是否举办签约仪式 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      是否举办签约仪式
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <label class="weui-radio__label">
                      <input
                        type="radio"
                        class="weui-radio"
                        name="signCeremony"
                        value="是"
                        required
                      />
                      <span>是</span>
                    </label>
                    <label class="weui-radio__label" style="margin-left: 16px">
                      <input
                        type="radio"
                        class="weui-radio"
                        name="signCeremony"
                        value="否"
                        required
                      />
                      <span>否</span>
                    </label>
                  </div>
                </div>

                <!-- 是否发布宣传报道 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      是否发布宣传报道
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <label class="weui-radio__label">
                      <input type="radio" class="weui-radio" name="publicity" value="是" required />
                      <span>是</span>
                    </label>
                    <label class="weui-radio__label" style="margin-left: 16px">
                      <input type="radio" class="weui-radio" name="publicity" value="否" required />
                      <span>否</span>
                    </label>
                  </div>
                </div>

                <!-- 宣传渠道 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">宣传渠道</label>
                  </div>
                  <div class="weui-cell__bd" style="display: flex; align-items: center; gap: 32px">
                    <label style="display: flex; align-items: center; font-size: 15px">
                      <input
                        type="checkbox"
                        name="publicityChannel"
                        value="行内"
                        style="margin-right: 4px"
                      />
                      行内
                    </label>
                    <label style="display: flex; align-items: center; font-size: 15px">
                      <input
                        type="checkbox"
                        name="publicityChannel"
                        value="行外"
                        style="margin-right: 4px"
                      />
                      行外
                    </label>
                  </div>
                </div>

                <!-- 活动照片上传 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动照片</label>
                  </div>
                  <div class="weui-cell__bd">
                    <div class="weui-uploader">
                      <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="activity-photo-list"></ul>
                        <div class="weui-uploader__input-box">
                          <input
                            id="activity-photo-input"
                            class="weui-uploader__input"
                            type="file"
                            accept="image/*"
                            multiple
                          />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <!-- 活动获客情况区域 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">活动获客情况</div>
              <div class="weui-cells weui-cells_form" id="activity-edit-customer-fields">
                <!-- 活动获客数量（小贷客户） -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动获客数量（小贷客户）
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      type="number"
                      id="activity-small-loan-customers"
                      value=""
                      required
                    />
                  </div>
                </div>

                <!-- 活动获客数量（小企业客户） -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动获客数量（小企业客户）
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      type="number"
                      id="activity-small-enterprise-customers"
                      value=""
                      required
                    />
                  </div>
                </div>

                <!-- 活动获客数量（合计） -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      活动获客数量（合计）
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      type="number"
                      id="activity-total-customers"
                      value=""
                      readonly
                      required
                    />
                  </div>
                </div>

                <!-- 存量客户数 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      存量客户数
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      type="number"
                      id="activity-existing-customers"
                      value=""
                      required
                    />
                  </div>
                </div>

                <!-- 潜在意向客户数 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      潜在意向客户数
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      type="number"
                      id="activity-potential-customers"
                      value=""
                      required
                    />
                  </div>
                </div>

                <!-- 待挖抢客户数 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      待挖抢客户数
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      type="number"
                      id="activity-waiting-customers"
                      value=""
                      required
                    />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="weui-form__opr-area">
            <button class="weui-btn weui-btn_primary">提交</button>
            <button class="weui-btn weui-btn_default">取消</button>
          </div>
        </form>
      </div>
      <!-- 客户信息详情页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-customer-detail">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">客户信息详情</div>
        </div>
        <div class="weui-form-preview" id="customer-detail-preview"></div>
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">共 0 条走访</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-activity-customer">
              新增走访
            </button>
          </div>
          <div class="weui-panel__bd" id="activity-detail-customer-list"></div>
        </div>

        <!-- 储备变更详情 -->
        <div class="weui-panel">
          <div class="weui-panel__hd">储备变更详情</div>
          <div class="weui-panel__bd">
            <!-- 步骤条 - 使用WeUI官方源码结构 -->
            <div class="weui-steps">
              <div class="weui-step">
                <div class="weui-step__icon"></div>
                <div class="weui-step__content">
                  <div class="weui-step__title">已支用</div>
                  <div class="weui-step__desc">
                    修改人：张经理
                    <br />
                    修改时间：2024-05-20 15:30:00
                  </div>
                </div>
              </div>
              <div class="weui-step">
                <div class="weui-step__icon"></div>
                <div class="weui-step__content">
                  <div class="weui-step__title">已放款</div>
                  <div class="weui-step__desc">
                    修改人：李主任
                    <br />
                    修改时间：2024-05-18 10:15:00
                  </div>
                </div>
              </div>
              <div class="weui-step">
                <div class="weui-step__icon"></div>
                <div class="weui-step__content">
                  <div class="weui-step__title">审批中</div>
                  <div class="weui-step__desc">
                    修改人：王客户经理
                    <br />
                    修改时间：2024-05-15 14:20:00
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 渠道信息详情页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-channel-detail">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">渠道信息详情</div>
        </div>
        <div class="weui-form-preview" id="channel-detail-preview"></div>

        <!-- 网格员信息板块 -->
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">网格员信息</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-grid-member">
              新增网格员
            </button>
          </div>
          <div class="weui-panel__bd" id="grid-members-list"></div>
        </div>

        <!-- 引荐客户信息板块 -->
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">引荐客户信息</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-referral-customer">
              关联客户
            </button>
          </div>
          <div class="weui-panel__bd" id="referral-customers-list"></div>
        </div>

        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">共 3 条走访</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-activity-customer">
              新增走访
            </button>
          </div>
          <div class="weui-panel__bd" id="activity-detail-customer-list"></div>
        </div>
      </div>
      <!-- 客户信息登记页面（编辑/回显） -->
      <div class="mobile-view" id="page-customer-edit">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">编辑客户信息</div>
        </div>
        <form class="weui-form" id="customer-edit-form">
          <div class="weui-form__control-area">
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">客户信息</div>
              <div class="weui-cells weui-cells_form" id="customer-edit-fields">
                <!-- 所属场景 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      所属场景
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="南京现代农业合作社" readonly required />
                  </div>
                </div>

                <!-- 所属活动 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">所属活动</label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select">
                      <option value="">请选择活动活动</option>
                      <option value="A001" selected>南京小微企业活动</option>
                      <option value="A002">秦淮区普惠活动</option>
                      <option value="A003">建邺区小贷活动</option>
                      <option value="A004">玄武区活动</option>
                      <option value="A005">栖霞区活动</option>
                    </select>
                  </div>
                </div>

                <!-- 所属渠道 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      所属渠道
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择渠道</option>
                      <option value="C001" selected>南京制造业协会</option>
                      <option value="C002">秦淮区政府</option>
                      <option value="C003">建邺区政府</option>
                      <option value="C004">玄武区商会</option>
                      <option value="C005">栖霞区商会</option>
                    </select>
                  </div>
                </div>

                <!-- 获客来源 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      获客来源
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择获客来源</option>
                      <option value="一支行长引荐" selected>一支行长引荐</option>
                      <option value="渠道推荐">渠道推荐</option>
                      <option value="客户介绍">客户介绍</option>
                      <option value="自主开发">自主开发</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 细分行业 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      细分行业
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择细分行业</option>
                      <option value="粮食收购" selected>粮食收购</option>
                      <option value="农产品加工">农产品加工</option>
                      <option value="农业服务">农业服务</option>
                      <option value="制造业">制造业</option>
                      <option value="零售业">零售业</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 企业名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">企业名称</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="customer-company" value="" />
                  </div>
                </div>

                <!-- 姓名 -->
                <div class="weui-cell weui-cell_active">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      姓名
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="customer-name" value="" required />
                  </div>
                </div>

                <!-- 联系方式 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      联系方式
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="customer-phone" value="" required />
                  </div>
                </div>

                <!-- 客户属性 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      客户属性
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择客户属性</option>
                      <option value="新客" selected>新客</option>
                      <option value="老客">老客</option>
                      <option value="潜在客户">潜在客户</option>
                    </select>
                  </div>
                </div>

                <!-- 网格员 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">网格员</label>
                  </div>
                  <div class="weui-cell__bd">
                    <select
                      class="weui-select"
                      id="grid-member-select"
                      onchange="handleGridMemberSelect()"
                    >
                      <option value="">请选择网格员</option>
                      <option value="张**" selected>张**</option>
                      <option value="李**">李**</option>
                      <option value="王**">王**</option>
                      <option value="赵**">赵**</option>
                      <option value="钱**">钱**</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 网格员手机号码 -->
                <div class="weui-cell" id="grid-member-phone-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">网格员手机号码</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      id="grid-member-phone"
                      value=""
                      placeholder="网格员手机号码"
                    />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="weui-form__opr-area">
            <button class="weui-btn weui-btn_primary">提交</button>
            <button class="weui-btn weui-btn_default">取消</button>
          </div>
        </form>
      </div>
      <!-- 储备客户信息编辑页面 -->
      <div class="mobile-view" id="page-reserve-customer-edit">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">储备客户信息编辑</div>
        </div>
        <form class="weui-form" id="reserve-customer-edit-form">
          <div class="weui-form__control-area">
            <!-- 客户基本信息区域 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">客户基本信息</div>
              <div class="weui-cells weui-cells_form" id="reserve-customer-basic-fields">
                <!-- 客户姓名 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      客户姓名
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="reserve-customer-name" value="" required />
                  </div>
                </div>

                <!-- 联系方式 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      联系方式
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="reserve-customer-phone" value="" required />
                  </div>
                </div>

                <!-- 企业名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">企业名称</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="reserve-customer-company" value="" />
                  </div>
                </div>

                <!-- 所属渠道 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      所属渠道
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-customer-channel" required>
                      <option value="">请选择渠道</option>
                      <option value="南京制造业协会">南京制造业协会</option>
                      <option value="秦淮区政府">秦淮区政府</option>
                      <option value="建邺区政府">建邺区政府</option>
                      <option value="玄武区商会">玄武区商会</option>
                      <option value="栖霞区商会">栖霞区商会</option>
                    </select>
                  </div>
                </div>

                <!-- 获客来源 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      获客来源
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-customer-source" required>
                      <option value="">请选择获客来源</option>
                      <option value="一支行长引荐">一支行长引荐</option>
                      <option value="渠道推荐">渠道推荐</option>
                      <option value="客户介绍">客户介绍</option>
                      <option value="自主开发">自主开发</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 细分行业 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      细分行业
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-customer-industry" required>
                      <option value="">请选择细分行业</option>
                      <option value="粮食收购">粮食收购</option>
                      <option value="农产品加工">农产品加工</option>
                      <option value="农业服务">农业服务</option>
                      <option value="制造业">制造业</option>
                      <option value="零售业">零售业</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>
            <!-- 产品信息区域 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">产品信息</div>
              <div class="weui-cells weui-cells_form" id="reserve-customer-product-fields">
                <!-- 产品名称 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      产品名称
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-product-name" required>
                      <option value="">请选择产品名称</option>
                      <option value="极速贷信用">极速贷信用</option>
                      <option value="经营贷">经营贷</option>
                      <option value="消费贷">消费贷</option>
                      <option value="抵押贷">抵押贷</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 申请金额 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      申请金额(万元)
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="number" id="reserve-amount" value="" required />
                  </div>
                </div>

                <!-- 申请期限 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      申请期限(月)
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="number" id="reserve-term" value="" required />
                  </div>
                </div>

                <!-- 担保方式 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      担保方式
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-guarantee" required>
                      <option value="">请选择担保方式</option>
                      <option value="信用">信用</option>
                      <option value="抵押">抵押</option>
                      <option value="质押">质押</option>
                      <option value="保证">保证</option>
                      <option value="组合担保">组合担保</option>
                    </select>
                  </div>
                </div>

                <!-- 利率水平 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">利率水平</label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-rate">
                      <option value="">请选择利率水平</option>
                      <option value="基准利率">基准利率</option>
                      <option value="基准利率上浮10%">基准利率上浮10%</option>
                      <option value="基准利率上浮20%">基准利率上浮20%</option>
                      <option value="基准利率上浮30%">基准利率上浮30%</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>
            <!-- 状态管理区域 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">状态管理</div>
              <div class="weui-cells weui-cells_form" id="reserve-customer-status-fields">
                <!-- 储备状态 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      储备状态
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="reserve-status" required>
                      <option value="">请选择状态</option>
                      <option value="已放款">已放款</option>
                      <option value="审批中">审批中</option>
                      <option value="待放款">待放款</option>
                      <option value="已拒绝">已拒绝</option>
                      <option value="客户撤回">客户撤回</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 预计放款时间 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">预计放款时间</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="date" id="reserve-expected-date" value="" />
                  </div>
                </div>

                <!-- 实际放款时间 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">实际放款时间</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="date" id="reserve-actual-date" value="" />
                  </div>
                </div>

                <!-- 备注 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">备注</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      id="reserve-remark"
                      value=""
                      placeholder="请输入备注信息"
                    />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="weui-form__opr-area">
            <button class="weui-btn weui-btn_primary">保存</button>
            <button class="weui-btn weui-btn_default">取消</button>
          </div>
        </form>
      </div>
      <!-- 渠道信息登记页面（编辑/回显） -->
      <div class="mobile-view" id="page-channel-edit">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">编辑渠道信息</div>
        </div>
        <form class="weui-form" id="channel-edit-form">
          <div class="weui-form__control-area">
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">渠道信息</div>
              <div class="weui-cells weui-cells_form" id="channel-edit-fields">
                <!-- 渠道类型 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      渠道类型
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="channel-type" required>
                      <option value="">请选择渠道类型</option>
                      <option value="政府部门">政府部门</option>
                      <option value="行业协会">行业协会</option>
                      <option value="商会组织">商会组织</option>
                      <option value="金融机构">金融机构</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 具体B端类型 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      具体B端类型
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="channel-b-type" required>
                      <option value="">请选择B端类型</option>
                      <option value="政府部门">政府部门</option>
                      <option value="行业协会">行业协会</option>
                      <option value="商会组织">商会组织</option>
                      <option value="金融机构">金融机构</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>

                <!-- 具体B端名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      具体B端名称
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="channel-name" value="" required />
                  </div>
                </div>

                <!-- 联系人 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">联系人</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="channel-contact" value="" />
                  </div>
                </div>

                <!-- 联系电话 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">联系电话</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="channel-phone" value="" />
                  </div>
                </div>

                <!-- 联系地址 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">联系地址</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" id="channel-address" value="" />
                  </div>
                </div>

                <!-- 合作状态 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      合作状态
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" id="channel-status" required>
                      <option value="">请选择合作状态</option>
                      <option value="合作中">合作中</option>
                      <option value="已暂停">已暂停</option>
                      <option value="已终止">已终止</option>
                      <option value="待合作">待合作</option>
                    </select>
                  </div>
                </div>

                <!-- 合作开始时间 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">合作开始时间</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="date" id="channel-start-date" value="" />
                  </div>
                </div>

                <!-- 备注 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">备注</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      id="channel-remark"
                      value=""
                      placeholder="请输入备注信息"
                    />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="weui-form__opr-area">
            <button class="weui-btn weui-btn_primary">提交</button>
            <button class="weui-btn weui-btn_default">取消</button>
          </div>
        </form>
      </div>
      <!-- 活动列表页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-activity-list">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">活动列表</div>
        </div>
        <div class="weui-search-bar" id="searchBar-activity">
          <form class="weui-search-bar__form">
            <div class="weui-search-bar__box">
              <i class="weui-icon-search"></i>
              <input
                type="search"
                class="weui-search-bar__input"
                placeholder="搜索活动名称/区域/条线"
                id="activity-search-input"
              />
              <a
                href="javascript:"
                class="weui-icon-clear"
                id="activity-search-clear"
                style="display: none"
              ></a>
            </div>
            <label class="weui-search-bar__label" id="activity-search-label">
              <i class="weui-icon-search"></i>
              <span>搜索活动名称/区域/条线</span>
            </label>
          </form>
        </div>
        <div class="weui-panel weui-panel_access" style="background: #fff">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1" id="activity-list-count"></span>
            <div style="display: flex; gap: 8px">
              <button class="weui-btn weui-btn_primary weui-btn_mini" onclick="handleAddActivity()">
                新增活动
              </button>
            </div>
          </div>
          <div class="weui-panel__bd" id="activity-list-full"></div>
        </div>
      </div>
      <!-- 客户列表页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-customer-list">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">客户列表</div>
        </div>
        <div class="weui-search-bar" id="searchBar-customer">
          <form class="weui-search-bar__form">
            <div class="weui-search-bar__box">
              <i class="weui-icon-search"></i>
              <input
                type="search"
                class="weui-search-bar__input"
                placeholder="搜索姓名/联系方式/条线"
                id="customer-search-input"
              />
              <a
                href="javascript:"
                class="weui-icon-clear"
                id="customer-search-clear"
                style="display: none"
              ></a>
            </div>
            <label class="weui-search-bar__label" id="customer-search-label">
              <i class="weui-icon-search"></i>
              <span>搜索姓名/联系方式/条线</span>
            </label>
          </form>
        </div>
        <div class="weui-panel weui-panel_access" style="background: #fff">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1" id="customer-list-count">共 5 条</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleAddCustomer()">
              新增客户
            </button>
          </div>
          <div class="weui-panel__bd" id="customer-list-full">
            <!-- 客户列表项 - 王小明 -->
            <div class="weui-cell weui-cell_active weui-cell_access">
              <div class="weui-cell__bd">
                <p style="font-weight: 500">王**</p>
                <p style="color: #888; font-size: 14px">电话：186****0897</p>
                <p style="color: #888; font-size: 14px">渠道：南京制造业协会</p>
              </div>
              <div class="weui-cell__ft"></div>
            </div>

            <!-- 客户列表项 - 李小红 -->
            <div class="weui-cell weui-cell_active weui-cell_access">
              <div class="weui-cell__bd">
                <p style="font-weight: 500">李**</p>
                <p style="color: #888; font-size: 14px">电话：139****1234</p>
                <p style="color: #888; font-size: 14px">渠道：秦淮区政府</p>
              </div>
              <div class="weui-cell__ft"></div>
            </div>

            <!-- 客户列表项 - 张小刚 -->
            <div class="weui-cell weui-cell_active weui-cell_access">
              <div class="weui-cell__bd">
                <p style="font-weight: 500">张**</p>
                <p style="color: #888; font-size: 14px">电话：158****5678</p>
                <p style="color: #888; font-size: 14px">渠道：建邺区政府</p>
              </div>
              <div class="weui-cell__ft"></div>
            </div>

            <!-- 客户列表项 - 赵小丽 -->
            <div class="weui-cell weui-cell_active weui-cell_access">
              <div class="weui-cell__bd">
                <p style="font-weight: 500">赵**</p>
                <p style="color: #888; font-size: 14px">电话：187****2345</p>
                <p style="color: #888; font-size: 14px">渠道：玄武区商会</p>
              </div>
              <div class="weui-cell__ft"></div>
            </div>

            <!-- 客户列表项 - 钱小军 -->
            <div class="weui-cell weui-cell_active weui-cell_access">
              <div class="weui-cell__bd">
                <p style="font-weight: 500">钱**</p>
                <p style="color: #888; font-size: 14px">电话：136****7890</p>
                <p style="color: #888; font-size: 14px">渠道：南京制造业协会</p>
              </div>
              <div class="weui-cell__ft"></div>
            </div>
          </div>
        </div>
      </div>
      <!-- 渠道列表页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-channel-list">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">渠道列表</div>
        </div>
        <div class="weui-search-bar" id="searchBar-channel">
          <form class="weui-search-bar__form">
            <div class="weui-search-bar__box">
              <i class="weui-icon-search"></i>
              <input
                type="search"
                class="weui-search-bar__input"
                placeholder="搜索渠道名称/类型/B端类型"
                id="channel-search-input"
              />
              <a
                href="javascript:"
                class="weui-icon-clear"
                id="channel-search-clear"
                style="display: none"
              ></a>
            </div>
            <label class="weui-search-bar__label" id="channel-search-label">
              <i class="weui-icon-search"></i>
              <span>搜索渠道名称/类型/B端类型</span>
            </label>
          </form>
        </div>
        <div class="weui-panel weui-panel_access" style="background: #fff">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1" id="channel-list-count"></span>
            <div style="display: flex; gap: 8px">
              <button class="weui-btn weui-btn_primary weui-btn_mini" onclick="handleAddChannel()">
                新增渠道
              </button>
            </div>
          </div>
          <div class="weui-panel__bd" id="channel-list-full"></div>
        </div>
      </div>
    </div>

    <h2>走访人员端 - 移动端</h2>
    <div class="page-row">
      <!-- 客户走访登记页面 -->
      <div class="mobile-view" id="page-customer-visit-register">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">客户走访登记</div>
        </div>
        <form class="weui-form" id="visit-customer-form">
          <div class="weui-form__control-area">
            <!-- 活动基本信息 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">活动基本信息</div>
              <div class="weui-cells weui-cells_form">
                <!-- 二级分行 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">二级分行</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="南京分行" readonly />
                  </div>
                </div>
                <!-- 一级支行 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">一级支行</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="鼓楼支行" readonly />
                  </div>
                </div>
                <!-- 活动名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动名称</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="南京小微企业活动" readonly />
                  </div>
                </div>
                <!-- 活动召开日期 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动召开日期</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="2024-06-01" readonly />
                  </div>
                </div>
              </div>
            </div>
            <!-- 客户基本信息 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">客户基本信息</div>
              <div class="weui-cells weui-cells_form">
                <!-- 所属场景 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      所属场景
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择场景</option>
                      <option value="南京现代农业合作社" selected>南京现代农业合作社</option>
                      <option value="南京制造业协会">南京制造业协会</option>
                      <option value="秦淮区政府">秦淮区政府</option>
                    </select>
                  </div>
                </div>
                <!-- 所属活动 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">所属活动</label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select">
                      <option value="">请选择活动</option>
                      <option value="南京小微企业活动" selected>南京小微企业活动</option>
                      <option value="秦淮区普惠活动">秦淮区普惠活动</option>
                      <option value="建邺区小贷活动">建邺区小贷活动</option>
                    </select>
                  </div>
                </div>
                <!-- 所属渠道 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      所属渠道
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择渠道</option>
                      <option value="南京制造业协会" selected>南京制造业协会</option>
                      <option value="秦淮区政府">秦淮区政府</option>
                      <option value="建邺区政府">建邺区政府</option>
                    </select>
                  </div>
                </div>
                <!-- 获客来源 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      获客来源
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择获客来源</option>
                      <option value="活动活动">活动活动</option>
                      <option value="渠道推荐">渠道推荐</option>
                      <option value="客户介绍">客户介绍</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>
                <!-- 细分行业 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      细分行业
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择细分行业</option>
                      <option value="制造业">制造业</option>
                      <option value="农业">农业</option>
                      <option value="服务业">服务业</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>
                <!-- 客户姓名 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      客户姓名
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      id="visit-customer-name"
                      class="weui-input"
                      value="王**"
                      placeholder="请输入客户姓名"
                      required
                    />
                  </div>
                </div>
                <!-- 客户联系方式 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      客户联系方式
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      id="visit-customer-phone"
                      class="weui-input"
                      value="186****0897"
                      placeholder="请输入联系方式"
                      required
                    />
                  </div>
                </div>
                <!-- 客户所属条线 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      客户所属条线
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select id="visit-customer-line" class="weui-select" required>
                      <option value="">请选择条线</option>
                      <option value="三农" selected>三农</option>
                      <option value="普惠">普惠</option>
                      <option value="小企业">小企业</option>
                      <option value="小贷">小贷</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>
            <!-- 客户走访情况 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">客户走访情况</div>
              <div class="weui-cells weui-cells_form">
                <!-- 走访人员类型 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访人员类型
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <div style="display: flex; align-items: center; gap: 32px">
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="visitorType"
                          value="渠道专员"
                          checked
                          style="margin-right: 4px"
                        />
                        渠道专员
                      </label>
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="visitorType"
                          value="一支行领导"
                          style="margin-right: 4px"
                        />
                        一支行领导
                      </label>
                    </div>
                    <div style="display: flex; align-items: center; gap: 32px; margin-top: 8px">
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="visitorType"
                          value="二支行长"
                          style="margin-right: 4px"
                        />
                        二支行长
                      </label>
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="visitorType"
                          value="客户经理"
                          style="margin-right: 4px"
                        />
                        客户经理
                      </label>
                    </div>
                  </div>
                </div>

                <!-- 走访日期 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访日期
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      id="visit-date"
                      class="weui-input"
                      type="date"
                      value="2025-10-10"
                      required
                    />
                  </div>
                </div>

                <!-- 储备业务金额 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">储备业务金额(万元)</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      id="visit-business-amount"
                      class="weui-input"
                      type="number"
                      value="100"
                      placeholder="请输入金额"
                    />
                  </div>
                </div>

                <!-- 走访地址 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访地址
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="" placeholder="请输入或选择地址" required />
                  </div>
                  <div class="weui-cell__ft">
                    <svg
                      width="22"
                      height="22"
                      viewBox="0 0 24 24"
                      fill="none"
                      xmlns="http://www.w3.org/2000/svg"
                      onclick="handleLocationSelect()"
                    >
                      <path
                        d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"
                        fill="currentColor"
                      />
                    </svg>
                  </div>
                </div>

                <!-- 走访照片 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访照片
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <div style="display: flex; gap: 8px; margin-top: 8px">
                      <div
                        style="
                          width: 80px;
                          height: 80px;
                          border: 2px dashed #ccc;
                          display: flex;
                          align-items: center;
                          justify-content: center;
                          background-color: #f9f9f9;
                        "
                      >
                        <span style="color: #999; font-size: 12px">📷</span>
                      </div>
                      <div
                        style="
                          width: 80px;
                          height: 80px;
                          border: 2px dashed #ccc;
                          display: flex;
                          align-items: center;
                          justify-content: center;
                          background-color: #f9f9f9;
                        "
                      >
                        <span style="color: #999; font-size: 12px">📷</span>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- 是否受理 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      是否受理
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <label class="weui-radio__label">
                      <input type="radio" class="weui-radio" name="accepted" value="是" required />
                      <span>是</span>
                    </label>
                    <label class="weui-radio__label" style="margin-left: 16px">
                      <input type="radio" class="weui-radio" name="accepted" value="否" required />
                      <span>否</span>
                    </label>
                  </div>
                </div>

                <!-- 是否持续跟进 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      是否持续跟进
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <label class="weui-radio__label">
                      <input type="radio" class="weui-radio" name="followup" value="是" required />
                      <span>是</span>
                    </label>
                    <label class="weui-radio__label" style="margin-left: 16px">
                      <input type="radio" class="weui-radio" name="followup" value="否" required />
                      <span>否</span>
                    </label>
                  </div>
                </div>

                <!-- 备注 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">备注</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      id="visit-remark"
                      class="weui-input"
                      value="11111"
                      placeholder="请输入备注信息"
                    />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="weui-form__opr-area">
            <button class="weui-btn weui-btn_primary">提交</button>
          </div>
        </form>
      </div>
      <!-- 渠道走访登记页面 -->
      <div class="mobile-view" id="page-channel-visit-register">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">渠道走访登记</div>
        </div>
        <form class="weui-form" id="visit-channel-form">
          <div class="weui-form__control-area">
            <!-- 活动基本信息 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">活动基本信息</div>
              <div class="weui-cells weui-cells_form">
                <!-- 二级分行 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">二级分行</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="南京分行" readonly />
                  </div>
                </div>
                <!-- 一级支行 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">一级支行</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="鼓楼支行" readonly />
                  </div>
                </div>
                <!-- 活动名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动名称</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="南京小微企业活动" readonly />
                  </div>
                </div>
                <!-- 活动召开日期 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动召开日期</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="2024-06-01" readonly />
                  </div>
                </div>
                <!-- 活动涉及渠道类型 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">活动涉及渠道类型</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="行业协会" readonly />
                  </div>
                </div>
              </div>
            </div>
            <!-- 渠道基本信息 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">渠道基本信息</div>
              <div class="weui-cells weui-cells_form">
                <!-- 渠道类型 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      渠道类型
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择渠道类型</option>
                      <option value="行业协会" selected>行业协会</option>
                      <option value="政府部门">政府部门</option>
                      <option value="商会">商会</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>
                <!-- 具体B端类型 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      具体B端类型
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择B端类型</option>
                      <option value="制造业协会" selected>制造业协会</option>
                      <option value="农业协会">农业协会</option>
                      <option value="服务业协会">服务业协会</option>
                      <option value="其他">其他</option>
                    </select>
                  </div>
                </div>
                <!-- 具体B端名称 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      具体B端名称
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      value="南京制造业协会"
                      placeholder="请输入B端名称"
                      required
                    />
                  </div>
                </div>
                <!-- 渠道联系人 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      渠道联系人
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      value="张**"
                      placeholder="请输入联系人姓名"
                      required
                    />
                  </div>
                </div>
                <!-- 联系方式 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      联系方式
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input
                      class="weui-input"
                      value="138****5678"
                      placeholder="请输入联系方式"
                      required
                    />
                  </div>
                </div>
                <!-- 一二支归属 -->
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      一二支归属
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <select class="weui-select" required>
                      <option value="">请选择归属</option>
                      <option value="二级分行" selected>二级分行</option>
                      <option value="一级支行">一级支行</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>
            <!-- 渠道走访情况 -->
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells__title">渠道走访情况</div>
              <div class="weui-cells weui-cells_form">
                <!-- 走访人员类型 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访人员类型
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <div style="display: flex; align-items: center; gap: 32px">
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="channelVisitorType"
                          value="渠道专员"
                          checked
                          style="margin-right: 4px"
                        />
                        渠道专员
                      </label>
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="channelVisitorType"
                          value="一支行领导"
                          style="margin-right: 4px"
                        />
                        一支行领导
                      </label>
                    </div>
                    <div style="display: flex; align-items: center; gap: 32px; margin-top: 8px">
                      <label style="display: flex; align-items: center; font-size: 15px">
                        <input
                          type="checkbox"
                          name="channelVisitorType"
                          value="二支行长"
                          style="margin-right: 4px"
                        />
                        二支行长
                      </label>
                    </div>
                  </div>
                </div>
                <!-- 走访日期 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访日期
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="date" value="2025-10-10" required />
                  </div>
                </div>

                <!-- 储备业务金额 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">储备业务金额(万元)</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="number" value="100" placeholder="请输入金额" />
                  </div>
                </div>

                <!-- 走访地址 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访地址
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="" placeholder="请输入或选择地址" required />
                  </div>
                  <div class="weui-cell__ft">
                    <svg
                      width="22"
                      height="22"
                      viewBox="0 0 24 24"
                      fill="none"
                      xmlns="http://www.w3.org/2000/svg"
                      onclick="handleLocationSelect()"
                    >
                      <path
                        d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"
                        fill="currentColor"
                      />
                    </svg>
                  </div>
                </div>

                <!-- 走访照片 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      走访照片
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <div style="display: flex; gap: 8px; margin-top: 8px">
                      <div
                        style="
                          width: 80px;
                          height: 80px;
                          border: 2px dashed #ccc;
                          display: flex;
                          align-items: center;
                          justify-content: center;
                          background-color: #f9f9f9;
                        "
                      >
                        <span style="color: #999; font-size: 12px">📷</span>
                      </div>
                      <div
                        style="
                          width: 80px;
                          height: 80px;
                          border: 2px dashed #ccc;
                          display: flex;
                          align-items: center;
                          justify-content: center;
                          background-color: #f9f9f9;
                        "
                      >
                        <span style="color: #999; font-size: 12px">📷</span>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- 是否受理 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      是否受理
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <label class="weui-radio__label">
                      <input
                        type="radio"
                        class="weui-radio"
                        name="channelAccepted"
                        value="是"
                        required
                      />
                      <span>是</span>
                    </label>
                    <label class="weui-radio__label" style="margin-left: 16px">
                      <input
                        type="radio"
                        class="weui-radio"
                        name="channelAccepted"
                        value="否"
                        required
                      />
                      <span>否</span>
                    </label>
                  </div>
                </div>

                <!-- 是否持续跟进 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">
                      <span style="color: #ff0000">*</span>
                      是否持续跟进
                    </label>
                  </div>
                  <div class="weui-cell__bd">
                    <label class="weui-radio__label">
                      <input
                        type="radio"
                        class="weui-radio"
                        name="channelFollowup"
                        value="是"
                        required
                      />
                      <span>是</span>
                    </label>
                    <label class="weui-radio__label" style="margin-left: 16px">
                      <input
                        type="radio"
                        class="weui-radio"
                        name="channelFollowup"
                        value="否"
                        required
                      />
                      <span>否</span>
                    </label>
                  </div>
                </div>

                <!-- 备注 -->
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">备注</label>
                  </div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" value="11111" placeholder="请输入备注信息" />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="weui-form__opr-area">
            <button class="weui-btn weui-btn_primary">提交</button>
          </div>
        </form>
      </div>
      <!-- 客户走访详情页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-customer-visit-detail">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">客户走访详情</div>
        </div>

        <!-- 客户基本信息预览 -->
        <div class="weui-form-preview" id="visit-customer-detail-preview">
          <div class="weui-form-preview__hd">
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">客户姓名</label>
              <em class="weui-form-preview__value">王**</em>
            </div>
          </div>
          <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">客户联系方式</label>
              <span class="weui-form-preview__value">186****0897</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">客户所属条线</label>
              <span class="weui-form-preview__value">三农</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">所属渠道</label>
              <span class="weui-form-preview__value">南京制造业协会</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">储备状态</label>
              <span class="weui-form-preview__value">已储备</span>
            </div>
          </div>
        </div>

        <!-- 走访记录列表 -->
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">该客户共 6 条走访</span>
            <button class="weui-btn weui-btn_mini weui-btn_primary" onclick="handleAddVisit()">
              新增走访
            </button>
          </div>
          <div class="weui-panel__bd" id="customer-visit-list">
            <!-- 走访记录1 -->
            <div class="weui-cell weui-cell_access" onclick="handleVisitDetail('V001')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #V001</div>
                <div style="font-size: 14px; color: #999">2025-10-10 · 100万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录2 -->
            <div class="weui-cell weui-cell_access" onclick="handleVisitDetail('V002')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #V002</div>
                <div style="font-size: 14px; color: #999">2025-10-15 · 150万元 · 未受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录3 -->
            <div class="weui-cell weui-cell_access" onclick="handleVisitDetail('V003')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #V003</div>
                <div style="font-size: 14px; color: #999">2025-10-20 · 80万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录4 -->
            <div class="weui-cell weui-cell_access" onclick="handleVisitDetail('V004')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #V004</div>
                <div style="font-size: 14px; color: #999">2025-10-25 · 200万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录5 -->
            <div class="weui-cell weui-cell_access" onclick="handleVisitDetail('V005')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #V005</div>
                <div style="font-size: 14px; color: #999">2025-10-30 · 120万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录6 -->
            <div class="weui-cell weui-cell_access" onclick="handleVisitDetail('V006')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #V006</div>
                <div style="font-size: 14px; color: #999">2025-11-05 · 300万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>
          </div>
        </div>
      </div>

      <!-- 渠道走访详情页面（严格WeUI结构，精细还原） -->
      <div class="mobile-view" id="page-channel-visit-detail">
        <div class="weui-navbar">
          <div class="weui-navbar__item weui-navbar__title">渠道走访详情</div>
        </div>

        <!-- 渠道基本信息预览 -->
        <div class="weui-form-preview" id="visit-channel-detail-preview">
          <div class="weui-form-preview__hd">
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">渠道名称</label>
              <em class="weui-form-preview__value">南京制造业协会</em>
            </div>
          </div>
          <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">渠道类型</label>
              <span class="weui-form-preview__value">B端渠道</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">具体B端类型</label>
              <span class="weui-form-preview__value">行业协会</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">渠道联系人</label>
              <span class="weui-form-preview__value">张**</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">联系方式</label>
              <span class="weui-form-preview__value">138****5678</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">一二支归属</label>
              <span class="weui-form-preview__value">一支行</span>
            </div>
          </div>
        </div>

        <!-- 走访记录列表 -->
        <div class="weui-panel">
          <div
            class="weui-panel__hd"
            style="display: flex; justify-content: space-between; align-items: center"
          >
            <span style="flex: 1">该渠道共 4 条走访</span>
            <button
              class="weui-btn weui-btn_mini weui-btn_primary"
              onclick="handleAddChannelVisit()"
            >
              新增走访
            </button>
          </div>
          <div class="weui-panel__bd" id="channel-visit-list">
            <!-- 走访记录1 -->
            <div class="weui-cell weui-cell_access" onclick="handleChannelVisitDetail('CV001')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #CV001</div>
                <div style="font-size: 14px; color: #999">2025-10-08 · 200万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录2 -->
            <div class="weui-cell weui-cell_access" onclick="handleChannelVisitDetail('CV002')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #CV002</div>
                <div style="font-size: 14px; color: #999">2025-10-18 · 150万元 · 未受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录3 -->
            <div class="weui-cell weui-cell_access" onclick="handleChannelVisitDetail('CV003')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #CV003</div>
                <div style="font-size: 14px; color: #999">2025-10-28 · 300万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>

            <!-- 走访记录4 -->
            <div class="weui-cell weui-cell_access" onclick="handleChannelVisitDetail('CV004')">
              <div class="weui-cell__bd">
                <div style="font-size: 16px; color: #333; margin-bottom: 4px">走访记录 #CV004</div>
                <div style="font-size: 14px; color: #999">2025-11-08 · 180万元 · 已受理</div>
              </div>
              <div class="weui-cell__ft weui-cell__ft_in-access"></div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- <h2>管理员端 - PC端</h2>
    <div class="page-row"></div> -->

    <script src="mockData.js"></script>
    <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.min.js"></script>
    <script>
      document.addEventListener('DOMContentLoaded', function () {
        // 客户列表页面 - 已重构为静态HTML，无需动态渲染
        // 客户搜索栏交互 - 简化版（仅UI交互，无搜索功能）
        const customerSearchInput = document.getElementById('customer-search-input')
        const customerSearchLabel = document.getElementById('customer-search-label')
        const customerSearchClear = document.getElementById('customer-search-clear')
        customerSearchInput.addEventListener('focus', function () {
          customerSearchLabel.style.display = 'none'
          customerSearchClear.style.display = 'inline-block'
        })
        customerSearchInput.addEventListener('blur', function () {
          if (!this.value) customerSearchLabel.style.display = 'block'
        })
        customerSearchInput.addEventListener('input', function () {
          // 搜索功能已移除，仅保留UI交互
          customerSearchClear.style.display = this.value ? 'inline-block' : 'none'
        })
        customerSearchClear.addEventListener('click', function () {
          customerSearchInput.value = ''
          customerSearchClear.style.display = 'none'
          customerSearchLabel.style.display = 'block'
        })

        // 客户详情页渲染（示例展示第一个客户）
        const customerDetailPreview = document.getElementById('customer-detail-preview')
        if (customerDetailPreview) {
          const cus = customers[0]
          customerDetailPreview.innerHTML = `
          <div class="weui-form-preview__hd">
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">姓名</label>
              <em class="weui-form-preview__value">${cus.姓名[0]}**</em>
            </div>
          </div>
          <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">联系方式</label>
              <span class="weui-form-preview__value">${
                cus.联系方式 ? cus.联系方式.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '暂无'
              }</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">所属场景</label>
              <span class="weui-form-preview__value">${cus.所属场景 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">所属活动</label>
              <span class="weui-form-preview__value">${cus.所属活动 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">所属渠道</label>
              <span class="weui-form-preview__value">${cus.所属渠道 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">获客来源</label>
              <span class="weui-form-preview__value">${cus.获客来源 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">细分行业</label>
              <span class="weui-form-preview__value">${cus.细分行业 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">企业名称</label>
              <span class="weui-form-preview__value">${cus.企业名称 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">客户属性</label>
              <span class="weui-form-preview__value">${cus.客户属性 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">网格员姓名</label>
              <span class="weui-form-preview__value">${cus.网格员姓名 || '暂无'}</span>
            </div>
            <div class="weui-form-preview__item">
              <label class="weui-form-preview__label">网格员手机号码</label>
              <span class="weui-form-preview__value">${
                cus.网格员手机号码
                  ? cus.网格员手机号码.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
                  : '暂无'
              }</span>
            </div>
          </div>
          <div class="weui-form-preview__ft">
            <a role="button" class="weui-form-preview__btn weui-form-preview__btn_p" href="javascript:;">编辑</a>
          </div>
        `
        }
        // 渠道列表页面 - 全量渲染+搜索
        function renderChannelList(filter = '') {
          const channelListFull = document.getElementById('channel-list-full')
          const channelListCount = document.getElementById('channel-list-count')
          let filtered = channels
          if (filter) {
            filtered = channels.filter(
              (cha) =>
                cha.具体B端名称.includes(filter) ||
                cha.渠道类型.includes(filter) ||
                cha.具体B端类型.includes(filter)
            )
          }
          channelListFull.innerHTML = ''
          if (filtered.length === 0) {
            channelListFull.innerHTML =
              '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>'
          } else {
            filtered.forEach((cha) => {
              const div = document.createElement('div')
              div.className = 'weui-cell weui-cell_active weui-cell_access'
              div.innerHTML = `<div class='weui-cell__bd'><p style='font-weight:500;'>${cha.具体B端名称}（${cha.渠道类型}）</p><p style='color:#888;font-size:14px;'>联系人：${cha.渠道联系人}</p></div><div class='weui-cell__ft'></div>`
              channelListFull.appendChild(div)
            })
          }
          channelListCount.textContent = `共 ${filtered.length} 条`
        }
        renderChannelList()
        // 渠道搜索栏交互
        const channelSearchInput = document.getElementById('channel-search-input')
        const channelSearchLabel = document.getElementById('channel-search-label')
        const channelSearchClear = document.getElementById('channel-search-clear')
        channelSearchInput.addEventListener('focus', function () {
          channelSearchLabel.style.display = 'none'
          channelSearchClear.style.display = 'inline-block'
        })
        channelSearchInput.addEventListener('blur', function () {
          if (!this.value) channelSearchLabel.style.display = 'block'
        })
        channelSearchInput.addEventListener('input', function () {
          renderChannelList(this.value)
          channelSearchClear.style.display = this.value ? 'inline-block' : 'none'
        })
        channelSearchClear.addEventListener('click', function () {
          channelSearchInput.value = ''
          renderChannelList()
          channelSearchClear.style.display = 'none'
          channelSearchLabel.style.display = 'block'
        })
        // 活动列表页面 - 全量渲染+搜索
        function renderActivityList(filter = '') {
          const activityListFull = document.getElementById('activity-list-full')
          const activityListCount = document.getElementById('activity-list-count')
          let filtered = activities
          if (filter) {
            filtered = activities.filter(
              (act) =>
                act.活动名称.includes(filter) ||
                act.二级分行.includes(filter) ||
                (act.主要条线 && act.主要条线.join(',').includes(filter))
            )
          }
          activityListFull.innerHTML = ''
          if (filtered.length === 0) {
            activityListFull.innerHTML =
              '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>'
          } else {
            filtered.forEach((act) => {
              const div = document.createElement('div')
              div.className = 'weui-cell weui-cell_active weui-cell_access'
              div.innerHTML = `<div class='weui-cell__bd'><p style='font-weight:500;'>${
                act.活动名称
              }（${act.二级分行}）</p><p style='color:#888;font-size:14px;'>日期：${
                act.活动召开日期
              } | 条线：${act.主要条线.join('、')}</p></div><div class='weui-cell__ft'></div>`
              activityListFull.appendChild(div)
            })
          }
          activityListCount.textContent = `共 ${filtered.length} 条`
        }
        renderActivityList()
        // 活动搜索栏交互
        const activitySearchInput = document.getElementById('activity-search-input')
        const activitySearchLabel = document.getElementById('activity-search-label')
        const activitySearchClear = document.getElementById('activity-search-clear')
        activitySearchInput.addEventListener('focus', function () {
          activitySearchLabel.style.display = 'none'
          activitySearchClear.style.display = 'inline-block'
        })
        activitySearchInput.addEventListener('blur', function () {
          if (!this.value) activitySearchLabel.style.display = 'block'
        })
        activitySearchInput.addEventListener('input', function () {
          renderActivityList(this.value)
          activitySearchClear.style.display = this.value ? 'inline-block' : 'none'
        })
        activitySearchClear.addEventListener('click', function () {
          activitySearchInput.value = ''
          renderActivityList()
          activitySearchClear.style.display = 'none'
          activitySearchLabel.style.display = 'block'
        })
        // 活动详情页面（数据渲染）
        const activityDetailPreview2 = document.getElementById('activity-detail-preview2')
        const activityDetailChannelList = document.getElementById('activity-detail-channel-list')
        const activityDetailVisitList = document.getElementById('activity-detail-customer-list-1')
        const activityDetailPhotoList = document.getElementById('activity-detail-photo-list')
        // 以第一个活动为例，实际应支持切换
        const activity = activities[0]
        if (activityDetailPreview2 && activity) {
          activityDetailPreview2.innerHTML = `
            <div class="weui-form-preview__hd">
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">活动名称</label>
                <em class="weui-form-preview__value">${activity.活动名称}</em>
              </div>
            </div>
            <div class="weui-form-preview__bd">
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">召开日期</label><span class="weui-form-preview__value">${
                activity.活动召开日期
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">地点</label><span class="weui-form-preview__value">${
                activity.活动地点县区
              } ${activity.活动地点镇街道}</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">二级分行</label><span class="weui-form-preview__value">${
                activity.二级分行
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">一级支行</label><span class="weui-form-preview__value">${
                activity.一级支行
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">主要条线</label><span class="weui-form-preview__value">${activity.主要条线.join(
                '/'
              )}</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">归属场景</label><span class="weui-form-preview__value">${
                activity.归属场景
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">共同发起方</label><span class="weui-form-preview__value">${
                activity.共同发起方
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">发起方出席人员</label><span class="weui-form-preview__value">${
                activity.共同发起方出席人员及职务
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">主要区域客群</label><span class="weui-form-preview__value">${
                activity.活动针对的主要区域客群
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">主要行业</label><span class="weui-form-preview__value">${
                activity.活动针对的主要行业
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">代表性企业</label><span class="weui-form-preview__value">${
                activity.代表性企业名称
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">是否举办签约仪式</label><span class="weui-form-preview__value">${
                activity.是否举办签约仪式
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">是否发布宣传报道</label><span class="weui-form-preview__value">${
                activity.是否发布宣传报道
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">宣传渠道</label><span class="weui-form-preview__value">${activity.宣传渠道.join(
                '/'
              )}</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">获客-小贷</label><span class="weui-form-preview__value">${
                activity.活动获客数量小贷客户
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">获客-小企业</label><span class="weui-form-preview__value">${
                activity.活动获客数量小企业客户
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">获客合计</label><span class="weui-form-preview__value">${
                activity.活动获客数量合计
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">存量客户数</label><span class="weui-form-preview__value">${
                activity.存量客户数
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">潜在意向客户数</label><span class="weui-form-preview__value">${
                activity.潜在意向客户数
              }</span></div>
              <div class="weui-form-preview__item"><label class="weui-form-preview__label">待挖抢客户数</label><span class="weui-form-preview__value">${
                activity.待挖抢客户数
              }</span></div>
            </div>
            <div class="weui-form-preview__ft">
              <a
                role="button"
                class="weui-form-preview__btn weui-form-preview__btn_primary"
                href="javascript:;"
              >
                编辑
              </a>
            </div>
          `
        }
        // 关联渠道列表
        if (activityDetailChannelList && activity) {
          const relatedChannels = channels.filter(
            (q) => q.参与活动 && q.参与活动.includes(activity.id)
          )
          if (relatedChannels.length === 0) {
            activityDetailChannelList.innerHTML =
              '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无关联渠道</span></div>'
          } else {
            activityDetailChannelList.innerHTML = relatedChannels
              .map(
                (q) => `
              <div class="weui-cell weui-cell_active weui-cell_access">
                <div class="weui-cell__bd">
                  <p style="font-weight:500;">${q.具体B端名称}（${q.渠道类型}）</p>
                  <p style="color:#888;font-size:14px;">联系人：${q.渠道联系人}</p>
                </div>
                <div class="weui-cell__ft"></div>
              </div>
            `
              )
              .join('')
          }
        }

        // 历史走访记录
        if (activityDetailVisitList && activity) {
          const visitRecords = [
            {
              id: 'V001',
              走访日期: '2025-01-15',
              走访人员: '张**、李**',
              走访内容: '了解协会需求，介绍银行产品',
              走访结果: '已受理',
            },
            {
              id: 'V002',
              走访日期: '2025-01-20',
              走访人员: '王**',
              走访内容: '跟进客户反馈，提供详细方案',
              走访结果: '持续跟进',
            },
            {
              id: 'V003',
              走访日期: '2025-01-25',
              走访人员: '张**、王**',
              走访内容: '签署合作协议，启动项目',
              走访结果: '已受理',
            },
          ]

          activityDetailVisitList.innerHTML = visitRecords
            .map(
              (record) => `
            <div class="weui-cell weui-cell_access">
                <div class="weui-cell__bd">
                <p style="font-weight: 500; font-size: 16px; margin: 0 0 4px 0;">${
                  record.走访日期
                } - ${record.走访人员}</p>
                <p style="color: #888; font-size: 14px; margin: 0;">${record.走访内容}</p>
                <p style="color: #10aeff; font-size: 14px; margin: 0;">${record.走访结果}</p>
                </div>
              <div class="weui-cell__ft">
                <a href="javascript:;" onclick="removeActivityCustomer(${visitRecords.indexOf(
                  record
                )})" style="color: #ff0000;">删除</a>
              </div>
              </div>
            `
            )
            .join('')
        }
        // 活动照片
        if (activityDetailPhotoList && activity) {
          if (!activity.活动照片 || activity.活动照片.length === 0) {
            activityDetailPhotoList.innerHTML =
              '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无活动照片</span></div>'
          } else {
            activityDetailPhotoList.innerHTML = activity.活动照片
              .map(
                (p) =>
                  `<img src="${p}" alt="活动照片" style="width:80px;height:80px;object-fit:cover;margin-right:8px;border-radius:8px;" />`
              )
              .join('')
          }
        }
        // 活动编辑表单 - 已重构为静态HTML，无需动态渲染
        // 客户信息编辑页面 - 静态HTML + 数据注入
        function populateCustomerForm(customerId = 'C001') {
          const customer = customers.find((c) => c.id === customerId) || customers[0]
          if (customer) {
            // 注入客户数据到表单
            document.getElementById('customer-name').value = customer.姓名 || ''
            document.getElementById('customer-phone').value = customer.联系方式 || ''
            document.getElementById('customer-company').value = customer.企业名称 || ''
            document.getElementById('grid-member-phone').value = customer.网格员手机号码 || ''

            // 设置下拉框选中值
            const channelSelect = document.querySelector('#customer-edit-fields select[required]')
            if (channelSelect) {
              const channelOption = Array.from(channelSelect.options).find((opt) =>
                opt.textContent.includes(customer.所属渠道 || '')
              )
              if (channelOption) channelOption.selected = true
            }
          }
        }

        // 页面加载时注入数据
        populateCustomerForm()

        // 活动编辑表单 - 静态HTML + 数据注入
        function populateActivityForm(activityId = 'A001') {
          const activity = activities.find((a) => a.id === activityId) || activities[0]
          if (activity) {
            // 注入活动基本信息
            document.getElementById('activity-scene').value = activity.归属场景 || ''
            document.getElementById('activity-branch').value = activity.二级分行 || ''
            document.getElementById('activity-sub-branch').value = activity.一级支行 || ''
            document.getElementById('activity-name').value = activity.活动名称 || ''
            document.getElementById('activity-date').value = activity.活动召开日期 || ''
            document.getElementById('activity-district').value = activity.活动地点县区 || ''
            document.getElementById('activity-street').value = activity.活动地点镇街道 || ''
            document.getElementById('activity-sponsor').value = activity.共同发起方 || ''
            document.getElementById('activity-sponsor-staff').value =
              activity.共同发起方出席人员及职务 || ''
            document.getElementById('activity-target-group').value =
              activity.活动针对的主要区域客群 || ''
            document.getElementById('activity-industry').value = activity.活动针对的主要行业 || ''
            document.getElementById('activity-representative-company').value =
              activity.代表性企业名称 || ''

            // 设置主要条线复选框
            if (activity.主要条线 && Array.isArray(activity.主要条线)) {
              activity.主要条线.forEach((line) => {
                const checkbox = document.querySelector(`input[name="mainLine"][value="${line}"]`)
                if (checkbox) checkbox.checked = true
              })
            }

            // 设置单选按钮
            const signCeremony = document.querySelector(
              `input[name="signCeremony"][value="${activity.是否举办签约仪式}"]`
            )
            if (signCeremony) signCeremony.checked = true

            const publicity = document.querySelector(
              `input[name="publicity"][value="${activity.是否发布宣传报道}"]`
            )
            if (publicity) publicity.checked = true

            // 设置宣传渠道复选框
            if (activity.宣传渠道 && Array.isArray(activity.宣传渠道)) {
              activity.宣传渠道.forEach((channel) => {
                const checkbox = document.querySelector(
                  `input[name="publicityChannel"][value="${channel}"]`
                )
                if (checkbox) checkbox.checked = true
              })
            }

            // 注入获客情况数据
            document.getElementById('activity-small-loan-customers').value =
              activity.活动获客数量小贷客户 || ''
            document.getElementById('activity-small-enterprise-customers').value =
              activity.活动获客数量小企业客户 || ''
            document.getElementById('activity-total-customers').value =
              activity.活动获客数量合计 || ''
            document.getElementById('activity-existing-customers').value = activity.存量客户数 || ''
            document.getElementById('activity-potential-customers').value =
              activity.潜在意向客户数 || ''
            document.getElementById('activity-waiting-customers').value =
              activity.待挖抢客户数 || ''
          }
        }

        // 页面加载时注入活动数据
        populateActivityForm()

        // 客户走访登记表单 - 静态HTML + 数据注入
        function populateVisitCustomerForm(visitId = 'V001') {
          const visit = visits.find((v) => v.id === visitId) || visits[0]
          if (visit) {
            // 注入客户信息
            const customerNameEl = document.getElementById('visit-customer-name')
            if (customerNameEl) customerNameEl.value = visit.客户姓名 || ''

            const customerPhoneEl = document.getElementById('visit-customer-phone')
            if (customerPhoneEl) customerPhoneEl.value = visit.客户联系方式 || ''

            const customerLineEl = document.getElementById('visit-customer-line')
            if (customerLineEl) customerLineEl.value = visit.客户所属条线 || ''

            const visitDateEl = document.getElementById('visit-date')
            if (visitDateEl) visitDateEl.value = visit.走访日期 || ''

            const businessAmountEl = document.getElementById('visit-business-amount')
            if (businessAmountEl) businessAmountEl.value = visit.储备业务金额 || ''

            const remarkEl = document.getElementById('visit-remark')
            if (remarkEl) remarkEl.value = visit.备注 || ''

            // 设置走访人员类型复选框
            if (visit.走访人员类型 && Array.isArray(visit.走访人员类型)) {
              visit.走访人员类型.forEach((type) => {
                const checkbox = document.querySelector(
                  `input[name="visitorType"][value="${type}"]`
                )
                if (checkbox) checkbox.checked = true
              })
            }
          }
        }

        // 页面加载时注入走访数据
        populateVisitCustomerForm()

        // 储备客户编辑表单 - 静态HTML + 数据注入
        function populateReserveCustomerForm(reserveCustomerId = 'RC001') {
          const reserveCustomer =
            reserveCustomers.find((rc) => rc.id === reserveCustomerId) || reserveCustomers[0]
          if (reserveCustomer) {
            // 注入客户基本信息
            document.getElementById('reserve-customer-name').value = reserveCustomer.姓名 || ''
            document.getElementById('reserve-customer-phone').value = reserveCustomer.联系方式 || ''
            document.getElementById('reserve-customer-company').value =
              reserveCustomer.企业名称 || ''
            document.getElementById('reserve-customer-channel').value =
              reserveCustomer.所属渠道 || ''
            document.getElementById('reserve-customer-source').value =
              reserveCustomer.获客来源 || ''
            document.getElementById('reserve-customer-industry').value =
              reserveCustomer.细分行业 || ''

            // 注入产品信息
            document.getElementById('reserve-product-name').value = reserveCustomer.产品名称 || ''
            document.getElementById('reserve-amount').value = reserveCustomer.申请金额 || ''
            document.getElementById('reserve-term').value = reserveCustomer.申请期限 || ''
            document.getElementById('reserve-guarantee').value = reserveCustomer.担保方式 || ''
            document.getElementById('reserve-rate').value = reserveCustomer.利率水平 || ''

            // 注入状态管理信息
            document.getElementById('reserve-status').value = reserveCustomer.储备状态 || ''
            document.getElementById('reserve-expected-date').value =
              reserveCustomer.预计放款时间 || ''
            document.getElementById('reserve-actual-date').value =
              reserveCustomer.实际放款时间 || ''
            document.getElementById('reserve-remark').value = reserveCustomer.备注 || ''
          }
        }

        // 页面加载时注入储备客户数据
        populateReserveCustomerForm()

        // 渠道编辑表单 - 静态HTML + 数据注入
        function populateChannelForm(channelId = 'CH001') {
          const channel = channels.find((c) => c.id === channelId) || channels[0]
          if (channel) {
            // 注入渠道信息
            document.getElementById('channel-type').value = channel.渠道类型 || ''
            document.getElementById('channel-b-type').value = channel.具体B端类型 || ''
            document.getElementById('channel-name').value = channel.具体B端名称 || ''
            document.getElementById('channel-contact').value = channel.联系人 || ''
            document.getElementById('channel-phone').value = channel.联系电话 || ''
            document.getElementById('channel-address').value = channel.联系地址 || ''
            document.getElementById('channel-status').value = channel.合作状态 || ''
            document.getElementById('channel-start-date').value = channel.合作开始时间 || ''
            document.getElementById('channel-remark').value = channel.备注 || ''
          }
        }

        // 页面加载时注入渠道数据
        populateChannelForm()

        // 储备客户信息编辑页面字段渲染
        const reserveCustomerBasicFields = document.getElementById('reserve-customer-basic-fields')
        const reserveCustomerProductFields = document.getElementById(
          'reserve-customer-product-fields'
        )
        const reserveCustomerStatusFields = document.getElementById(
          'reserve-customer-status-fields'
        )

        // 产品名称选项 - 移到全局作用域，确保总是被定义
        let productOptions = `
          <option value="">请选择产品名称</option>
          <option value="极速贷信用" selected>极速贷信用</option>
          <option value="经营贷">经营贷</option>
          <option value="消费贷">消费贷</option>
          <option value="抵押贷">抵押贷</option>
          <option value="其他">其他</option>
        `

        if (reserveCustomerBasicFields) {
          // 客户基本信息区域
          reserveCustomerBasicFields.innerHTML = `
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">所属场景</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="江宁生态养殖区" readonly /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">所属活动</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="南京新街口活动" readonly /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">所属渠道</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="南京制造业" readonly /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>二分</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="南京市分行" required /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>一支</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="雨花区支行" required /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>网点</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="XX" required /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">客户经理工号</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="2023010309" readonly /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">客户经理姓名</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="赵三" readonly /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">客户姓名</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="张*" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>手机号码(可修改)</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="186****0897" required /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">网格员</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="李*" readonly /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">网格员手机号</label></div>
              <div class="weui-cell__bd"><input class="weui-input" value="183****0892" readonly /></div>
            </div>
          `
        }

        if (reserveCustomerProductFields) {
          // 产品信息区域
          reserveCustomerProductFields.innerHTML = `
            <div class="weui-cell weui-cell_select weui-cell_select-after" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>产品名称</label></div>
              <div class="weui-cell__bd"><select class="weui-select" required>${productOptions}</select></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">测额日期(受理日期)</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="date" value="2025-10-10" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">申请金额(万元)</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="number" value="100" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">上报日期</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="date" value="2025-10-10" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">上报金额(万元)</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="number" value="100" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">获批日期</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="date" value="2025-10-10" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">获批金额(万元)</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="number" value="100" /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>预计支用日期</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="date" value="2025-10-10" required /></div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>预计支用金额(万元)</label></div>
              <div class="weui-cell__bd"><input class="weui-input" type="number" value="20" required /></div>
            </div>
          `
        }

        if (reserveCustomerStatusFields) {
          // 状态管理区域
          reserveCustomerStatusFields.innerHTML = `
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">调查是否超期</label></div>
              <div class="weui-cell__bd" style="display: flex; gap: 16px;">
                <label style="display: flex; align-items: center; font-size: 15px">
                  <input type="radio" name="investigationOverdue" value="是" checked style="margin-right: 4px" />
                  是
                </label>
                <label style="display: flex; align-items: center; font-size: 15px">
                  <input type="radio" name="investigationOverdue" value="否" style="margin-right: 4px" />
                  否
                </label>
              </div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">放款是否超期</label></div>
              <div class="weui-cell__bd" style="display: flex; gap: 16px;">
                <label style="display: flex; align-items: center; font-size: 15px">
                  <input type="radio" name="loanOverdue" value="是" checked style="margin-right: 4px" />
                  是
                </label>
                <label style="display: flex; align-items: center; font-size: 15px">
                  <input type="radio" name="loanOverdue" value="否" style="margin-right: 4px" />
                  否
                </label>
              </div>
            </div>
            <div class="weui-cell" style="padding: 12px 15px;">
              <div class="weui-cell__hd"><label class="weui-label">备注</label></div>
              <div class="weui-cell__bd"><textarea class="weui-textarea" placeholder="请输入备注信息" rows="3"></textarea></div>
            </div>
          `
        }

        // 渠道信息登记页面（编辑/回显）
        const channelEditFields = document.getElementById('channel-edit-fields')
        if (channelEditFields) {
          const channel = channels[0]
          if (channel) {
            // 新增所属活动字段
            let activityOptions = activities
              .map((a) => `<option value="${a.活动名称}">${a.活动名称}</option>`)
              .join('')
            channelEditFields.innerHTML = `
            <div class="weui-cell"><div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>所属场景</label></div><div class="weui-cell__bd"><input class="weui-input" value="南京现代农业合作社" readonly required /></div></div>
            <div class="weui-cell"><div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>二级分行</label></div><div class="weui-cell__bd"><input class="weui-input" value="${activity.二级分行}" readonly required /></div></div>
            <div class="weui-cell"><div class="weui-cell__hd"><label class="weui-label">一级支行</label></div><div class="weui-cell__bd"><input class="weui-input" value="${activity.一级支行}" readonly /></div></div>
              <div class="weui-cell weui-cell_select weui-cell_select-after"><div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>所属活动</label></div><div class="weui-cell__bd"><select class="weui-select" required>${activityOptions}</select></div></div>
              <div class="weui-cell"><div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>渠道类型</label></div><div class="weui-cell__bd"><select class="weui-select" required><option value="商协会">商协会</option><option value="政府部门">政府部门</option><option value="企业">企业</option></select></div></div>
              <div class="weui-cell"><div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>具体B端类型</label></div><div class="weui-cell__bd"><select class="weui-select" required><option value="行业协会">行业协会</option><option value="商业协会">商业协会</option><option value="政府部门</option></select></div></div>
              <div class="weui-cell"><div class="weui-cell__hd"><label class="weui-label"><span style="color: #ff0000;">*</span>具体B端名称</label></div><div class="weui-cell__bd"><input class="weui-input" value="${channel.具体B端名称}" required /></div></div>
            `
          } else {
            channelEditFields.innerHTML =
              '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无渠道数据</span></div>'
          }
        }

        // 渠道详情页面渲染
        const channelDetailPreview = document.getElementById('channel-detail-preview')
        const gridMembersList = document.getElementById('grid-members-list')
        const referralCustomersList = document.getElementById('referral-customers-list')

        if (channelDetailPreview) {
          const channel = channels[0]
          channelDetailPreview.innerHTML = `
            <div class="weui-form-preview__hd">
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">渠道类型</label>
                <em class="weui-form-preview__value">${channel.渠道类型}</em>
              </div>
            </div>
            <div class="weui-form-preview__bd">
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">具体B端类型</label>
                <span class="weui-form-preview__value">${channel.具体B端类型}</span>
              </div>
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">具体B端名称</label>
                <span class="weui-form-preview__value">${channel.具体B端名称}</span>
              </div>
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">联系人</label>
                <span class="weui-form-preview__value">${channel.联系人 || '暂无'}</span>
              </div>
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">联系电话</label>
                <span class="weui-form-preview__value">${channel.联系电话 || '暂无'}</span>
              </div>
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">联系地址</label>
                <span class="weui-form-preview__value">${channel.联系地址 || '暂无'}</span>
              </div>
            </div>
          `
        }

        // 初始化示例数据
        if (!window.channelGridMembers) {
          window.channelGridMembers = [
            { 姓名: '张**', 手机号码: '183****0892', 职务: '网格员' },
            { 姓名: '李**', 手机号码: '139****1234', 职务: '渠道专员' },
            { 姓名: '王**', 手机号码: '158****5678', 职务: '客户经理' },
          ]
        }

        if (!window.channelReferralCustomers) {
          window.channelReferralCustomers = [
            { id: 'C001', 姓名: '王**', 联系方式: '186****0897', 所属渠道: '南京制造业协会' },
            { id: 'C002', 姓名: '李**', 联系方式: '139****1234', 所属渠道: '南京制造业协会' },
            { id: 'C003', 姓名: '张**', 联系方式: '158****5678', 所属渠道: '南京制造业协会' },
          ]
        }

        // 网格员列表渲染
        if (gridMembersList) {
          renderGridMembersList()
        }

        // 引荐客户列表渲染
        if (referralCustomersList) {
          renderReferralCustomersList()
        }

        // 走访记录列表渲染
        const activityDetailCustomerList = document.getElementById(
          'activity-detail-customer-list-1'
        )
        if (activityDetailCustomerList) {
          const visitRecords = [
            {
              id: 'V001',
              走访日期: '2025-01-15',
              走访人员: '张**、李**',
              走访内容: '了解协会需求，介绍银行产品',
              走访结果: '已受理',
            },
            {
              id: 'V002',
              走访日期: '2025-01-20',
              走访人员: '王**',
              走访内容: '跟进客户反馈，提供详细方案',
              走访结果: '持续跟进',
            },
            {
              id: 'V003',
              走访日期: '2025-01-25',
              走访人员: '张**、王**',
              走访内容: '签署合作协议，启动项目',
              走访结果: '已受理',
            },
          ]

          activityDetailCustomerList.innerHTML = visitRecords
            .map(
              (record, index) => `
            <div class="weui-cell weui-cell_access">
              <div class="weui-cell__bd">
                <p style="font-weight: 500; font-size: 16px; margin: 0 0 4px 0;">${record.走访日期} - ${record.走访人员}</p>
                <p style="color: #888; font-size: 14px; margin: 0;">${record.走访内容}</p>
                <p style="color: #10aeff; font-size: 14px; margin: 0;">${record.走访结果}</p>
              </div>
              <div class="weui-cell__ft">
                <a href="javascript:;" onclick="removeActivityCustomer(${index})" style="color: #ff0000;">删除</a>
              </div>
            </div>
          `
            )
            .join('')
        }

        // 动态添加输入框函数
        window.addDynamicInput = function (id) {
          const container = document.getElementById(id)
          if (container) {
            const newInput = document.createElement('div')
            newInput.className = 'weui-cell'
            newInput.innerHTML = container.innerHTML.replace(/<a.+?\+<\/a>/, '')
            container.parentNode.insertBefore(newInput, container.nextSibling)
          }
        }
        // 网格员成对动态添加函数
        window.addWgPairRow = function (el) {
          const row = el.closest('.wg-pair-row')
          const newRow = row.cloneNode(true)
          newRow.querySelectorAll('input').forEach((input) => (input.value = ''))
          row.parentNode.insertBefore(newRow, row.nextSibling)
        }

        // 网格员相关函数
        function renderGridMembersList() {
          const gridMembersList = document.getElementById('grid-members-list')
          if (gridMembersList) {
            const channelGridMembers = window.channelGridMembers || []
            if (channelGridMembers.length === 0) {
              gridMembersList.innerHTML =
                '<div class="weui-cell weui-cell_access"><div class="weui-cell__bd"><p class="weui-cell__desc">暂无网格员信息</p></div></div>'
            } else {
              gridMembersList.innerHTML = channelGridMembers
                .map(
                  (member, index) => `
                <div class="weui-cell weui-cell_access">
                  <div class="weui-cell__bd">
                    <p style="font-weight: 500; font-size: 16px; margin: 0 0 4px 0;">${member.姓名}</p>
                    <p style="color: #888; font-size: 14px; margin: 0;">联系人: ${member.职务}</p>
                  </div>
                  <div class="weui-cell__ft">
                    <a href="javascript:;" onclick="removeGridMember(${index})" style="color: #ff0000;">删除</a>
                  </div>
                </div>
              `
                )
                .join('')
            }
          }
        }

        function renderReferralCustomersList() {
          const referralCustomersList = document.getElementById('referral-customers-list')
          if (referralCustomersList) {
            const channelReferralCustomers = window.channelReferralCustomers || []
            if (channelReferralCustomers.length === 0) {
              referralCustomersList.innerHTML =
                '<div class="weui-cell weui-cell_access"><div class="weui-cell__bd"><p class="weui-cell__desc">暂无引荐客户</p></div></div>'
            } else {
              referralCustomersList.innerHTML = channelReferralCustomers
                .map(
                  (customer, index) => `
                <div class="weui-cell weui-cell_access">
                  <div class="weui-cell__bd">
                    <p style="font-weight: 500; font-size: 16px; margin: 0 0 4px 0;">${customer.姓名}</p>
                    <p style="color: #888; font-size: 14px; margin: 0;">联系人: ${customer.联系方式}</p>
                  </div>
                  <div class="weui-cell__ft">
                    <a href="javascript:;" onclick="removeReferralCustomer(${index})" style="color: #ff0000;">删除</a>
                  </div>
                </div>
              `
                )
                .join('')
            }
          }
        }

        // 网格员弹窗相关函数
        window.openGridMemberDialog = function () {
          document.getElementById('grid-member-mask').style.display = 'block'
          document.getElementById('grid-member-dialog').style.display = 'block'
        }

        window.closeGridMemberDialog = function () {
          document.getElementById('grid-member-mask').style.display = 'none'
          document.getElementById('grid-member-dialog').style.display = 'none'
          // 清空输入框
          document.getElementById('grid-member-name').value = ''
          document.getElementById('grid-member-phone').value = ''
          document.getElementById('grid-member-position').value = ''
        }

        window.saveGridMember = function () {
          const name = document.getElementById('grid-member-name').value
          const phone = document.getElementById('grid-member-phone').value
          const position = document.getElementById('grid-member-position').value

          if (!name || !phone) {
            alert('请填写姓名和手机号码')
            return
          }

          if (!window.channelGridMembers) {
            window.channelGridMembers = []
          }

          window.channelGridMembers.push({
            姓名: name,
            手机号码: phone,
            职务: position || '网格员',
          })

          renderGridMembersList()
          closeGridMemberDialog()
        }

        window.removeGridMember = function (index) {
          if (confirm('确定要删除这个网格员吗？')) {
            window.channelGridMembers.splice(index, 1)
            renderGridMembersList()
          }
        }

        // 客户关联弹窗相关函数
        window.openCustomerAssociationDialog = function () {
          document.getElementById('customer-association-mask').style.display = 'block'
          document.getElementById('customer-association-dialog').style.display = 'block'
          renderCustomerAssociationList()
        }

        window.closeCustomerAssociationDialog = function () {
          document.getElementById('customer-association-mask').style.display = 'none'
          document.getElementById('customer-association-dialog').style.display = 'none'
        }

        function renderCustomerAssociationList(filter = '') {
          const customerAssociationList = document.getElementById('customer-association-list')
          if (customerAssociationList) {
            let filteredCustomers = customers
            if (filter) {
              filteredCustomers = customers.filter(
                (customer) =>
                  customer.姓名.includes(filter) ||
                  customer.联系方式.includes(filter) ||
                  customer.所属渠道.includes(filter)
              )
            }

            if (filteredCustomers.length === 0) {
              customerAssociationList.innerHTML =
                '<div class="weui-cell"><div class="weui-cell__bd"><p class="weui-cell__desc">暂无客户信息</p></div></div>'
            } else {
              customerAssociationList.innerHTML = filteredCustomers
                .map(
                  (customer) => `
                <div class="weui-cell weui-cell_access" onclick="associateCustomer('${customer.id}')">
                  <div class="weui-cell__bd">
                    <p class="weui-cell__desc">${customer.姓名}</p>
                    <p class="weui-cell__desc">${customer.联系方式} - ${customer.所属渠道}</p>
                  </div>
                  <div class="weui-cell__ft">
                  </div>
                </div>
              `
                )
                .join('')
            }
          }
        }

        window.associateCustomer = function (customerId) {
          const customer = customers.find((c) => c.id === customerId)
          if (customer) {
            if (!window.channelReferralCustomers) {
              window.channelReferralCustomers = []
            }

            // 检查是否已经关联
            const isAlreadyAssociated = window.channelReferralCustomers.some(
              (c) => c.id === customerId
            )
            if (isAlreadyAssociated) {
              alert('该客户已经关联过了')
              return
            }

            window.channelReferralCustomers.push(customer)
            renderReferralCustomersList()
            closeCustomerAssociationDialog()
          }
        }

        window.removeReferralCustomer = function (index) {
          if (confirm('确定要删除这个关联客户吗？')) {
            window.channelReferralCustomers.splice(index, 1)
            renderReferralCustomersList()
          }
        }

        window.removeActivityCustomer = function (index) {
          if (confirm('确定要删除这个客户吗？')) {
            // 这里可以添加删除逻辑
            console.log('删除客户:', index)
          }
        }

        // 绑定按钮事件
        const addGridMemberBtn = document.getElementById('add-grid-member')
        if (addGridMemberBtn) {
          addGridMemberBtn.addEventListener('click', openGridMemberDialog)
        }

        const addReferralCustomerBtn = document.getElementById('add-referral-customer')
        if (addReferralCustomerBtn) {
          addReferralCustomerBtn.addEventListener('click', openCustomerAssociationDialog)
        }

        // 客户搜索功能
        const customerAssociationSearchInput = document.getElementById('customer-search-input')
        if (customerAssociationSearchInput) {
          customerAssociationSearchInput.addEventListener('input', function (e) {
            renderCustomerAssociationList(e.target.value)
          })
        }

        // 客户走访详情页渲染函数（只在需要时调用）
        window.renderVisitCustomerDetail = function () {
          const visitCustomerDetailPreview = document.getElementById(
            'visit-customer-detail-preview'
          )
          if (visitCustomerDetailPreview) {
            // 显示客户基本信息
            const customer = customers[0] || {}
            visitCustomerDetailPreview.innerHTML = `
              <div class="weui-form-preview__hd">
                <div class="weui-form-preview__item">
                  <label class="weui-form-preview__label">客户姓名</label>
                  <em class="weui-form-preview__value">${customer.姓名 || '王**'}</em>
                </div>
              </div>
              <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                  <label class="weui-form-preview__label">客户联系方式</label>
                  <span class="weui-form-preview__value">${
                    customer.联系方式 || '186****0897'
                  }</span>
                </div>
                <div class="weui-form-preview__item">
                  <label class="weui-form-preview__label">客户所属条线</label>
                  <span class="weui-form-preview__value">${customer.所属条线 || '三农'}</span>
                </div>
              </div>
            `
          }

          // 渲染走访记录列表
          const visitListContainer = document.querySelector('.weui-panel')
          if (visitListContainer) {
            const visitListHTML = visits
              .map(
                (visit, index) => `
              <div class="weui-panel__bd">
                <div class="weui-media-box weui-media-box_text" style="border-bottom: 1px solid #e5e5e5;">
                  <div class="weui-media-box__hd">
                    <div style="width: 40px; height: 40px; background-color: #1aad19; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 14px; font-weight: bold;">
                      ${index + 1}
                    </div>
                  </div>
                  <div class="weui-media-box__bd">
                    <h4 class="weui-media-box__title" style="font-size: 16px; margin-bottom: 8px;">
                      走访记录 #${visit.id || index + 1}
                    </h4>
                    <p class="weui-media-box__desc" style="color: #999; font-size: 14px; margin-bottom: 4px;">
                      <span style="color: #333;">走访日期：</span>${visit.走访日期 || '2025-10-10'}
                    </p>
                    <p class="weui-media-box__desc" style="color: #999; font-size: 14px; margin-bottom: 4px;">
                      <span style="color: #333;">走访人员：</span>${
                        Array.isArray(visit.走访人员类型)
                          ? visit.走访人员类型.join('、')
                          : '渠道专员'
                      }
                    </p>
                    <p class="weui-media-box__desc" style="color: #999; font-size: 14px; margin-bottom: 4px;">
                      <span style="color: #333;">储备金额：</span>${visit.储备业务金额 || '100'}万元
                    </p>
                    <p class="weui-media-box__desc" style="color: #999; font-size: 14px; margin-bottom: 4px;">
                      <span style="color: #333;">是否受理：</span>${visit.是否受理 || '是'}
                    </p>
                    <p class="weui-media-box__desc" style="color: #999; font-size: 14px;">
                      <span style="color: #333;">持续跟进：</span>${visit.是否持续跟进 || '是'}
                    </p>
                  </div>
                </div>
              </div>
            `
              )
              .join('')

            visitListContainer.innerHTML = `
              <div class="weui-panel__hd" style="display: flex; justify-content: space-between; align-items: center">
                <span style="flex: 1">该客户共 ${visits.length} 条走访</span>
                <button class="weui-btn weui-btn_mini weui-btn_primary" id="add-activity-customer">
                  新增走访
                </button>
              </div>
              ${visitListHTML}
            `
          }
        }

        // 处理走访详情点击
        window.handleVisitDetail = function (visitId) {
          weui.confirm(`查看走访记录 ${visitId} 的详细信息`, {
            title: '走访详情',
            buttons: [
              {
                label: '确定',
                type: 'primary',
              },
            ],
          })
        }

        // 处理渠道走访详情点击
        window.handleChannelVisitDetail = function (visitId) {
          weui.confirm(`查看渠道走访记录 ${visitId} 的详细信息`, {
            title: '渠道走访详情',
            buttons: [
              {
                label: '确定',
                type: 'primary',
              },
            ],
          })
        }
        
        // 页面导航功能
        const navItems = document.querySelectorAll('.nav-item');
        const pages = document.querySelectorAll('.mobile-view');
        const backToTopBtn = document.getElementById('backToTop');
        
        // 导航点击事件
        navItems.forEach(item => {
          item.addEventListener('click', function(e) {
            e.preventDefault();
            const targetPageId = this.getAttribute('data-page');
            const targetPage = document.getElementById(targetPageId);
            
            if (targetPage) {
              // 设置滚动标志，防止滚动监听器干扰
              isScrolling = true;
              
              // 移除所有高亮
              pages.forEach(page => page.classList.remove('page-highlight'));
              
              // 移除所有导航项激活状态
              navItems.forEach(nav => nav.classList.remove('active'));
              
              // 添加当前导航项激活状态
              this.classList.add('active');
              
              // 滚动到目标页面
              targetPage.scrollIntoView({ 
                behavior: 'smooth',
                block: 'start'
              });
              
              // 添加高亮效果
              setTimeout(() => {
                targetPage.classList.add('page-highlight');
                // 2秒后移除高亮
                setTimeout(() => {
                  targetPage.classList.remove('page-highlight');
                }, 2000);
              }, 500);
              
              // 滚动完成后重置标志
              setTimeout(() => {
                isScrolling = false;
              }, 1000);
            }
          });
        });
        
        // 返回顶部按钮
        if (backToTopBtn) {
          backToTopBtn.addEventListener('click', function() {
            window.scrollTo({
              top: 0,
              behavior: 'smooth'
            });
          });
          
          // 监听滚动事件，显示/隐藏返回顶部按钮
          window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
              backToTopBtn.classList.add('show');
            } else {
              backToTopBtn.classList.remove('show');
            }
          });
        }
        
        // 监听滚动事件，更新导航激活状态
        let isScrolling = false;
        window.addEventListener('scroll', function() {
          if (isScrolling) return; // 防止在程序滚动时触发
          
          let current = '';
          const scrollTop = window.pageYOffset;
          const windowHeight = window.innerHeight;
          
          pages.forEach(page => {
            const pageTop = page.offsetTop;
            const pageHeight = page.offsetHeight;
            const pageBottom = pageTop + pageHeight;
            
            // 检查页面是否在视窗中，使用更精确的判断
            if (scrollTop >= pageTop - 200 && scrollTop < pageBottom - 100) {
              current = page.getAttribute('id');
            }
          });
          
          navItems.forEach(item => {
            item.classList.remove('active');
            if (item.getAttribute('data-page') === current) {
              item.classList.add('active');
            }
          });
        });
      })
    </script>
    
    <!-- 返回顶部按钮 -->
    <button class="back-to-top" id="backToTop">↑</button>
  </body>
</html>
